Javascript 为什么mongodb不给我100多个文档?
为什么我的查询不能处理集合中的100多个文档Javascript 为什么mongodb不给我100多个文档?,javascript,node.js,mongodb,Javascript,Node.js,Mongodb,为什么我的查询不能处理集合中的100多个文档 db.collection('allowedmacs').find().toArray(function(err, docs) { console.log(docs); } 厄尔说: name: 'MongoError', message: 'connection destroyed, not possible to instantiate cursor' 如果文档您可能正在执行以下操作: db.collection('allowedmacs')
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
}
厄尔说:
name: 'MongoError',
message: 'connection destroyed, not possible to instantiate cursor'
如果文档您可能正在执行以下操作:
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
});
db.close();
因此,在调用对toArray
的回调之前关闭数据库(尽管在某些情况下可能会起作用)
相反,请尝试以下方法:
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
db.close();
});
书中写道:
MongoDB支持的BSON文档嵌套级别不超过100级
也许你会考虑: