Why does my query not working with more than 100 documents in collection?
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
}
err says this:
name: 'MongoError',
message: 'connection destroyed, not possible to instantiate cursor'
If documents <100 all works fine.
You're probably doing something like this:
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
});
db.close();
So you're closing the database before the callback to toArray
has been called (although it may work on some occassions).
Instead, try this:
db.collection('allowedmacs').find().toArray(function(err, docs) {
console.log(docs);
db.close();
});
in source there is written:
MongoDB supports no more than 100 levels of nesting for BSON documents.
maybe you look into : Mongo and find always limited to 100 with geo data