objectId in mongoDB is of total 12 bytes hexadecimal number is unique for every document in a collection. which is a comobination of 4 bytes timestamp, 3 bytes of machine id, 2 bytes of process id and 3 bytes of incrementer or random counter.
if we do not mention the _id field explicitly it is inserted by the sever itself.
if one wants to insert the _id field, how it should be constructed explicitly??
ex:
db.mycol.insert({
_id: ObjectId(7df78ad8902c),
title: 'MongoDB Overview',
description: 'MongoDB is no sql database',
by: 'Query Home',
url: 'http://tech.queryhome.com',
tags: ['mongodb', 'database', 'NoSQL'],
likes: 100
})
In the above example _id: ObjectId(7df78ad8902c) this bold part. how this 12 bytes id is constructed manually??