I am trying to restore a existing mongodb database data..when i restore that by command line i got this line as error
2017-06-10T12:27:55.474+0530 too many positional arguments
2017-06-10T12:27:55.476+0530 try 'mongorestore --help' for more information
I used this line
C:\Program Files\MongoDB\Server\3.4\bin> mongorestore F:\mongo_db\db
Anyone please help me to get rid from this error
I found the solution after some time. Alternatively, we don't want to point the mongodb folder as of my question C:\Program Files\MongoDB\Server\3.4\bin>
.
Simply Used this command . It restores the existing database, else creates the database if it's not existing.here,
mongorestore --host <database-host> -d <database-name> --port <database-port> foldername
Don't forgot to start mongodb server before use this command. For your localhost
database-host --> localhost
database-name --> Your db Name
database-port --> 27017
This error may occur when your folder name have space or hyphen(-) nomenclature, Please check the database contain folder name that it should not have any space or hyphen(-) in its nomenclature before restoring the database.
Below are used and tested cmd command line query for mongodb database restore
C:\Program Files\MongoDB\Server\4.0\bin>mongorestore -d foldername folderpath
Foldername - Name of the folder where your database dump exist.
Folderpath - A complete path(url) of your system where it database dump exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With