Michael Kruglos
Michael Kruglos

Reputation: 1286

How to write the file output to the server

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.

Upvotes: 0

Views: 34

Answers (1)

Jake Noh
Jake Noh

Reputation: 216

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.

Upvotes: 1

Related Questions