Closed bacloud23 closed 9 months ago
Is your feature request related to a problem? Please describe. Many apps I believe are based on the _id and how it is defined by MongoDB.
_id
In my case for instance, I use it as the time of creation of documents. Directly in a query in order for instance to get documents by creation time.
function getObjectId(days) { const yesterday = new Date() days = days || 14 yesterday.setDate(yesterday.getDate() - days) const hexSeconds = Math.floor(yesterday / 1000).toString(16) return new ObjectId(hexSeconds + '0000000000000000') } const objectId = getObjectId(days) const query = {} query._id = { $gt: objectId }
Describe the solution you'd like Add an option to use mongoDB ids
Describe alternatives you've considered I have no alternative other than adding createdAt field and change all my queries.
createdAt
My bad I totally ignored the option timestampData.. a bit of rework and it would be fine. feel free to close.
timestampData
Is your feature request related to a problem? Please describe. Many apps I believe are based on the
_id
and how it is defined by MongoDB.In my case for instance, I use it as the time of creation of documents. Directly in a query in order for instance to get documents by creation time.
Describe the solution you'd like Add an option to use mongoDB ids
Describe alternatives you've considered I have no alternative other than adding
createdAt
field and change all my queries.