| 24 | |
| Result :- 2018-03-01T18:30:00.000Z | |
| Use only for comparisons, not for creating new documents as this is not unique. | |
The ObjectId class is the default primary key for a MongoDB document and is usually found in the _id field in an inserted document.
Using ObjectId you can find the document creation time because timestamp is hidden in the ObjectId.
ObjectId contain the following:
| Size | Description | 
|---|---|
| 4 bytes | a 4-byte value representing the seconds since the Unix epoch | 
| 3 bytes | a 3-byte machine identifier | 
| 2 bytes | 2-byte process id | 
| 3 bytes | 3-byte counter, starting with a random value | 
Complete HTML:
 
 
                   
No comments