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

In your query:

mongodump --port 27019 --db pms --collection purchase --queryFile “{”_id":{"$gte":{"$oid":“5e461d06dba04739ea454892”}}}" --out D:\backup_export\admin\admin\ --gzip

You are using the --queryFile option. But, you have the query instead of the file name. So the error. Change the --queryFile to --query.


Since there is no error in this case, the issue must be with the query criteria and the available data in the collection. Also, the type of quotes you are using might be the problem; use straight quotes " " instead of “ ”.