Skip to content

Instantly share code, notes, and snippets.

@GalassoLuca
Last active April 29, 2022 09:21
Show Gist options
  • Save GalassoLuca/017ce2ea997a56576d5731674fbbbe26 to your computer and use it in GitHub Desktop.
Save GalassoLuca/017ce2ea997a56576d5731674fbbbe26 to your computer and use it in GitHub Desktop.
query MongoDB documents based on creation date present in ObjectId
const idFromDate = ObjectId.fromDate(ISODate("2021-02-08"))
db['collection'].count({ _id: { $gte: idFromDate } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment