Skip to content Skip to sidebar Skip to footer

Why Mongodb Not Giving Me More Than 100 Documents?

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: nam

Solution 1:

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();
});

Solution 2:

Post a Comment for "Why Mongodb Not Giving Me More Than 100 Documents?"