var
mongoclient
=
require('mongodb').mongoclient
var
db_conn_str
=
'mongodb://localhost:27017/wilsondb1'
var
selectdata
=
function(db,
callback)
{
//连接到表
var
collection
=
db.collection('tb2')
//查询数据
var
wherestr
=
{"name":'wilson001'}
collection.find(wherestr).toarray(function(err,
result)
{
if(err)
{
console.log('error:'+
err)
return
}
callback(result)
})
}
mongoclient.connect(db_conn_str,
function(err,
db)
{
console.log("连接成功!")
selectdata(db,
function(result)
{
console.log(result)
db.close()
})
})
怎么通过nodejs中的启动入口文件app.js自动启动mongodb数据库若要发送多个参数、 字符串、 整数,等等:
SoapObject request = new SoapObject(NAMESPACE, METHOD)
PropertyInfo variableHeight = new PropertyInfo()
variableHeight.setName("height")
variableHeight.setValue(value)// your variable value
variableHeight.setType(Integer.class)// if its string type change to String.class
request.addProperty(variableHeight)
PropertyInfo variableWidth = new PropertyInfo()
variableWidth.setName("width")
variableWidth.setValue(value)
variableWidth.setType(Integer.class)
request.addProperty(variableWidth)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)