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?
Example collection:
[
{_id: 1, name: "Sam"},
{_id: 2, name: "Sam"},
{_id: 3, name: "Paul"},
]
Example index: {name: 1}
(is this technically {name: 1, _id: 1}
?)
Would the index order consistently be
[
{_id: 3, name: "Paul"},
{_id: 1, name: "Sam"},
{_id: 2, name: "Sam"},
]