collection有多个文档,如果查询结果没有进行sort排序,那么find()的结果集的默认顺序是以什么为标准的?
走同样的路,发现不同的人生
Basically the order in the file (so it is often the order of insert).
To be cautious, you can think of it as disorder. If you need a specific order, you still have to use sort.
Reference:
http://docs.mongodb.org/manual/reference/glossary/#term-natural-order
When mongodb inserts data, it will add the "_id" attribute by default and create an index with it. So it's the order of insertion.
Basically the order in the file (so it is often the order of insert).
To be cautious, you can think of it as disorder. If you need a specific order, you still have to use sort.
Reference:
http://docs.mongodb.org/manual/reference/glossary/#term-natural-order
When mongodb inserts data, it will add the "_id" attribute by default and create an index with it. So it's the order of insertion.