app.get('/render', function(req, res) {
MongoClient.connect(dburl, function(err, db) {
if (err) throw err;
var collection = db.collection('shopping_list');
collection.find().toArray(function(err, result) {
res.send({result :result});
});
db.close();
});
});在nodejs中,collection.find()不从Mongodb获取值,collection.It在nodejs中不返回任何内容,collection.find()没有从Mongodb获取值,collection.It没有返回任何内容
发布于 2017-09-19 05:51:41
exports.index = function(req, res) {
var queryObj = {};
UserModel.find(queryObj)
.exec(function(err, users) {
if (!users) {
console.log("users not found");
}
if (!err) {
console.log("number of users",users.length);
} else {
console.log("err",err);
}
});};
https://stackoverflow.com/questions/46292266
复制相似问题