Hi there! I seem to recall reading somewhere that all indexes have an implicit “_id” field tacked onto the end of them to enforce consistent (albeit opaque) ordering even in case of ties.
Am I totally wrong about that? If so, the rest of this post doesn’t matter
Someone mind pointing me to where I might have read this?
Is the implicit “_id” field ascending or descending?
No. indexes do not include _id in them if you don’t explicitly state that on index creation…
The order of documents will probably be done on the natural insert order of the indexed documents, however without a proper sort statement the order is never guaranteed…
Thanks for the quick answer. I think I might’ve gotten that idea in my head since we use default mongo-generated ObjectIds, so our _ids ARE in the natural insert order.
How is insert order tracked when someone uses their own _id?