I\'m trying to export just one object with mongoexport, filtering by its ID.
I tried:
mongoexport -d \"kb_development\" -c \"articles\" -q \"{\'_id\'
My MongoDB verion: 3.2.4. when I use mongoexport tool in mongo shell:
NOT WORK:
-q '{"_id":ObjectId("5719cd12b1168b9d45136295")}'
-q '{_id: {"$oid": "5719cd12b1168b9d45136295"}}'
WORKs:
-q "{_id:ObjectId('5719cd12b1168b9d45136295')}"
- Though in mongo doc , it says that
You must enclose the query in single quotes (e.g. ') to ensure that it does not interact with your shell environment.
- But, single quote(') does not work! please use double quote(")!