Created
June 6, 2022 13:45
-
-
Save rodrigoborgesdeoliveira/da696e364a54fb6d3588c8e317f1970c to your computer and use it in GitHub Desktop.
On MongoDB, update createdAt (or any other field) based on _id's timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.collection.updateMany({}, [{ $set: { createdAt: { $toDate: "$_id" } } }]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment