How to export all collections in MongoDB?

前端 未结 28 1610
你的背包
你的背包 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:00

    First, of Start the Mongo DB - for that go to the path as ->

    C:\Program Files\MongoDB\Server\3.2\bin and click on the mongod.exe file to start MongoDB server.

    Command in Windows to Export

    • Command to export MongoDB database in Windows from "remote-server" to the local machine in directory C:/Users/Desktop/temp-folder from the remote server with the internal IP address and port.

    C:> mongodump --host remote_ip_address:27017 --db -o C:/Users/Desktop/temp-folder

    Command in Windows to Import

    • Command to import MongoDB database in Windows to "remote-server" from local machine directory C:/Users/Desktop/temp-folder/db-dir

    C:> mongorestore --host=ip --port=27017 -d C:/Users/Desktop/temp-folder/db-dir

提交回复
热议问题