Skip to content
Justice Tech School

ObjectId

_id defaults to a 12 byte ObjectId.

Example
var id = ObjectId();
id.getTimestamp()
db.users.find({ _id: ObjectId("650000000000000000000001") })

Exercise

Default id field.

The  field is unique

Quiz Test

Which field is always unique?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.