Unable to Use Mongo Export Query

前端 未结 2 1185
广开言路
广开言路 2020-12-19 00:11

I have a collecton named \"sample\" and database named \"at\" present in Mongo DB .

db.sample.find().pretty()
{
        \"         


        
相关标签:
2条回答
  • 2020-12-19 00:49

    mongoexport must be run from your OS command shell, not the mongo shell.

    0 讨论(0)
  • 2020-12-19 01:04

    Or if that doesn't work try this approach.

    If there is NO db or data folders in \bin folder, create them.

    Then open a new terminal and run:

    for example - "C:\Program Files\MongoDB\Server\4.0\bin\mongo.exe"

    Leave this terminal open and minimize it.

    Now open another terminal and run:

    for example -"C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe"

    Leave open and minimize as well. Now open one more terminal and navigate to your

    mongodb folder: for example "C:\Program Files\MongoDB\Server\4.0\bin" Once in the correct filepath run whatever mongo commands you want but instead of

    mongoexport try this ./mongoexport

    Hopefully, this may help someone.

    You should be able to run a command like:

    ./mongoexport -h YOUR.mlab.com:PORT -d YOUR-DB-NAME -c <collection> -u <user> -p <password> -o <output file>
    

    Or for the entire DB use:

    ./mongodump -h YOUR.mlab.com:PORT -d YOUR-DB-NAME -u ADMIN-USER -p PASSWORD -o C:\Luke\I\Am\Your\Father\DestinationOfAllCollections
    
    0 讨论(0)
提交回复
热议问题