C100DBA · Question #48
By default, the MongoDB cursor in mongo shell is configured to return how many documents? To get the next set of documents, which command is used?
The correct answer is C. 20, it. Option C is correct because the MongoDB shell (mongo) automatically paginates query results, displaying the first 20 documents by default and then pausing. To retrieve the next batch, you type it (short for "iterate"), which advances the cursor through the remaining results. Why
Question
By default, the MongoDB cursor in mongo shell is configured to return how many documents? To get the next set of documents, which command is used?
Options
- A200, more
- BNo limit, none
- C20, it
- D50, it
How the community answered
(44 responses)- A2% (1)
- C95% (42)
- D2% (1)
Explanation
Option C is correct because the MongoDB shell (mongo) automatically paginates query results, displaying the first 20 documents by default and then pausing. To retrieve the next batch, you type it (short for "iterate"), which advances the cursor through the remaining results.
Why the distractors are wrong:
- A (200, more) - Neither value is accurate;
moreis not a MongoDB shell command. - B (No limit, none) - MongoDB deliberately limits output to prevent flooding the terminal; there is always a default batch size.
- D (50, it) - The command
itis correct here, but the document count of 50 is wrong; the actual default is 20.
Memory tip: Think "20 = two fingers, IT = ITerate" - MongoDB shows you 20 at a time, and you iterate to see more, just like iterating through a loop in code.
Topics
Community Discussion
No community discussion yet for this question.