Description
Timestamps documentation reads:
If you create a BSON Timestamp using the empty constructor (e.g. new Timestamp()), MongoDB will only generate a timestamp if you use the constructor in the first field of the document. [2] Otherwise, MongoDB will generate an empty timestamp value (i.e. Timestamp(0, 0).)
And then:
[2]
If the first field in the document is _id, then you can generate a timestamp in the second field of a document.In the following example, MongoDB will generate a Timestamp value, even though the Timestamp() constructor is not in the first field in the document:
db.bios.insert( { _id: 9, last_updated: new Timestamp() } )
But as shown in SERVER-15367 this is no longer the case. The behavior seems be be new in 2.6.
Attachments
Issue Links
- is related to
-
DOCS-4086 How to store local time in MongoDB?
-
- Closed
-