How to export all collections in MongoDB?

前端 未结 28 1589
你的背包
你的背包 2020-11-29 14:32

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

mongoexport -d dbname -o Mongo.json

The result is:
No collection specifie

28条回答
  •  生来不讨喜
    2020-11-29 14:56

    If you want to dump all collections in all databases (which is an expansive interpretation of the original questioner's intent) then use

    mongodump
    

    All the databases and collections will be created in a directory called 'dump' in the 'current' location

提交回复
热议问题