How to export all collections in MongoDB?

前端 未结 28 1533
你的背包
你的背包 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 15:04

    You can do it using the mongodump command

    Step 1 : Open command prompt

    Step 2 : go to bin folder of your mongoDB installation (C:\Program Files\MongoDB\Server\4.0\bin)

    Step 3 : then execute the following command

    mongodump -d your_db_name -o destination_path

    your_db_name = test

    destination_path = C:\Users\HP\Desktop

    Exported files will be created in destination_path\your_db_name folder (in this example C:\Users\HP\Desktop\test)

    References : o7planning

提交回复
热议问题