0

In MySQL I can do select * from some_table into outfile 'myfile.csv' Is there something similar in MongoDB? Cannot find relevant information in the documenatation. I'm working with mongodb 2.2.3.

Michael Kruglos
  • 1,205
  • 14
  • 26

1 Answers1

1

You might want to use mongoexport, which produces a JSON or CSV export of data stored in a MongoDB instance

mongoexport --db dbName --collection collectionName --jsonArray --pretty --query '{"key": "value"}' --output output.json

For more details, please refer to mongoDB documentation.

Jake Noh
  • 216
  • 1
  • 7