Prev Next

Database / MongoDB Interview questions

What is the structure of ObjectID in MongoDB?

ObjectId is 12 bytes: 4-byte timestamp, 5-byte random value, and 3-byte incrementing counter. The timestamp makes default _id values roughly sortable.

ObjectID is a 12-byte BSON type. It is composed of,

  • 4 bytes value representing seconds,
  • 3 byte machine identifier,
  • 2 byte process id,
  • 3 byte counter.

More Related questions...

Show more question and Answers...


Comments & Discussions