Closed niftylettuce closed 2 years ago
I took a closer look and it doesn't look like Mongoose 6 ever uses getTimestamps()
. https://github.com/Automattic/mongoose/blob/1e6ccc55d93a1f4f5a2822a9afed305a173f996a/lib/helpers/timestamps/setupTimestamps.js#L50 is always false because this
is a document, not a schema, in that line. So unless the ObjectId
happens to have an auto
property, we'll always use defaultTimestamp
.
We'll get rid of that code since it is dead for practical purposes.
Docs should mention that
createdAt
usesthis._id.getTimestamp()
here https://mongoosejs.com/docs/guide.html#timestamps, and instead might be confusing as the reader would think it uses the current time.Internally we can see that Mongoose uses this here:
Via
this._id.getTimestamp()