有没有办法为mongo查询创建同步find()?
像:
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017/mydb', function(err, db){
if(err) throw err;
var collection = db.collection('mycollection');
var myarray = collection.find({});
//use myarray
for (var i = myarray.length - 1; i >= 0; i--) {
console.log(myarray[i]);
};
});