When we run the Mongo find () query without specifying the sort order, what internal database is used to sort the results?
According to the documentation on mongo website :
When performing a search () without parameters, the database returns objects in the direct natural order.
For standard tables, the natural order is not particularly useful, because although the order is often close to the order of placement, this is not guaranteed. However, for Capped Collections, the natural order is the guaranteed insert order. This can be very helpful.
However, for standard collections (uncovered collections), which field is used to sort the results? Is this _id field or something else?
Edit:
Basically, I assume that I'm trying to understand that if I performed the following search query:
db.collection.find({"x":y}).skip(10000).limit(1000);
At two different points in time: t1 and t2 , I get different result sets:
- If there was no additional entry between t1 and t2?
- When did the new entries between t1 and t2 appear?
- Are there new indexes added between t1 and t2?
I performed several tests in the temp database and the results I got are the same ( Yes ) for all three cases - but I wanted to be sure, and I'm sure my test cases were not very thorough.
mongodb
saurabhj Jul 22 '12 at 9:20 2012-07-22 09:20
source share