Parvin Gasimzade Parvin Gasimzade - 1 year ago 142
JSON Question

Dump Mongo Collection into JSON format

Is there any way to dump mongo collection into json format? Either on the shell or using java driver.I am looking for the one with best performance.

Answer Source

Mongo includes a mongoexport utility which can dump a collection:

mongoexport -c <collection_name>

Use the '-o' flag to write the output to file, otherwise standard output is used. This utility uses the native libmongoclient and is likely the fastest method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download