Is MongoDB _id (ObjectId) generated in an ascending order?

前端 未结 3 1706
悲哀的现实
悲哀的现实 2020-12-31 04:11

I know how the _id column contains a representation of timestamp when the document has been inserted into the collection. here is an online utility to convert it to timestam

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-31 04:31

    _id: ObjectId(4 bytes timestamp, 3 bytes machine id, 2 bytes process id, 3 bytes incrementer)

    This is the id structure. So only last 3 bytes will increment uniquely. So the answer of your question is yes.

提交回复
热议问题