I see you are using Windows OS. I couldn’t get the query filter with _id
(an ObjectId
) working, But the following worked fine. Assuming that there is a field called as name
and it is of string type, I could export the documents with names “Krish”:
mongodump --db=test --collection=test --query="{\"name\": \"Krish\"}"
The documentation says that if the query filter fields use the ObjectId
or date
type fields they must be specified as Extended JSON in the filter.