79632481

Date: 2025-05-21 17:23:33
Score: 0.5
Natty:
Report link

One can use mongo embedded operator inside a query to extract the date from the _id.
I've used it to figure out the creation date of documents when retroactively needed them, by using:

{"createdAt": {"$toDate": "$_id"}}

Or any object id:

{"createdAt": {"$toDate": ObjectId("67e410e95889aedda612bcdf")}}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: madarinho