uses for mongodb ObjectId creation time

前端 未结 6 1783
逝去的感伤
逝去的感伤 2020-12-04 11:04

The ObjectId used as the default key in mongodb documents has embedded timestamp (calling objectid.generation_time returns a datetime object). So it is possible

6条回答
  •  臣服心动
    2020-12-04 11:41

    From: http://www.mongodb.org/display/DOCS/Object+IDs#ObjectIDs-DocumentTimestamps

    "sorting on an _id field that stores ObjectId values is roughly equivalent to sorting by creation time, although this relationship is not strict with ObjectId values generated on multiple systems within a single second."

提交回复
热议问题