0

I have total 45 documents in the collection named users. Cant understood why the db.users.find({}, {username: 1}) command returning only first 20 documents.enter image description here

I also tried the db.users.find({}, {username: 1}).limit(40) to test, but still it returning the same.

Abid
  • 477
  • 1
  • 4
  • 15

1 Answers1

3

MongoDB displays 20 documents max in terminal. You can type it to iterate over other elements and display them. You can type the command DBQuery.shellBatchSize = 100 to increase this limit to 100.

Refer the following link to know more about this command Change the mongo Shell Batch Size

A similar query is also answered here How to print out more than 20 items (documents) in MongoDB's shell?

Sanket Dalvi
  • 86
  • 1
  • 6