Isnβt it easier to use one of Mongo drivers for a general-purpose language (for example, Python, Ruby, Java, etc.) and write the results to a file in such a way in a format that you can use (for example, in CSV, etc. .)?
UPDATE: According to the documentation for mongodump, you can export the collection with the request:
$ ./mongodump --db blog --collection posts -q '{"created_at" : { "$gte" : {"$date" : 1293868800000}, "$lt" : {"$date" : 1296460800000} } }'
However, you will need to import this collection back into MongoDB to work, or use mongoexport to export as JSON or CSV using the same request flag ( -q ) as mongodump .
Darren Newton Jan 23 2018-12-12T00: 00Z
source share