I\'m trying to export just one object with mongoexport, filtering by its ID.
I tried:
mongoexport -d \"kb_development\" -c \"articles\" -q \"{\'_id\'
many of the answers provided here didn't work for me, the error was with my double quotes. Here is what worked for me:
mongoexport -h localhost -d database_name -c collection_name -q {_id:ObjectId('50584580ff0f089602066633')} -o output_file.json
remember to use single quote only for the ObjectId string.