How to export all collections in MongoDB?
Asked 07 September, 2021
Viewed 1.8K times
  • 59
Votes

I want to export all collections in MongoDB by the command:

mongoexport -d dbname -o Mongo.json

The result is:
No collection specified!

The manual says, if you don't specify a collection, all collections will be exported.
However, why doesn't this work?

http://docs.mongodb.org/manual/reference/mongoexport/#cmdoption-mongoexport--collection

My MongoDB version is 2.0.6.

30 Answer