How to take backup based on ISODate or ObjectID using mongodump v4.2.2?

mongodump --port 27019 --db pms --collection purchase --query "{ \"dt\":{ \"$gte\": { \"$date\": \"2020-02-14T04:07:34Z\" } } }" --out D:\backup_export\admin\admin --gzip

Please note that:

  • D:\backup_export\admin\admin should be a directory.
  • --gzip is an option you can use
  • dt is the name of the field in the purchase collection in the pms database

Make sure there is data in your collection by running this query from Mongo Shell; and these documents will be exported:
db.purchase.find( { dt: { $gte: ISODate("2020-02-14T04:07:34Z") } } )

For more details on mongodump see the documentation.