why mongorestore command don't run? - mongodb

I insert in the command prompt##
mongorestore --db gescom C:\Users\LENOVO\OneDrive\Bureau\S2\BD noSQL\TP\employes\employes.bson
this is the problem log
2021-03-09T23:02:10.672+0100 error parsing command line options: error parsing positional arguments: provide only one polling interval in seconds and only one MongoDB connection string. Connection strings must begin with mongodb:// or mongodb+srv:// schemes
2021-03-09T23:02:10.718+0100 try 'mongorestore --help' for more information

Related

Mongodump - command not found when executing dump

I'm trying to create a backup of my database using Mongodump. The problem is that every time i execute the dump, i get the following error:
--collection: command not found
Here is the command:
mongodump --uri=MYURI --collection TEST-COL --gzip --out=/var/backups/testbackup
I'm using linux, while on windows the same command seems to work. Any advice?
The URI is a connection string, must be wrap with double quotes ("").
--uri=<connectionString>

How to restore a db in mongoDB

i tried to restore a db using mongorestore but i get this error:
2020-09-14T18:48:59.210+0200 error parsing command line options: error parsing positional arguments: provide only one polling interval in seconds and only one MongoDB connection string. Connection strings must begin with mongodb:// or mongodb+srv:// schemes
2020-09-14T18:48:59.258+0200 try 'mongorestore --help' for more information
I tried a lot of combinations, like this:
mongorestore -h localhost -d projectdb C:\Users\leo\Downloads\project\projectdbfiles
But without success.. i read the documentation and i tried to use --host:host and /host:host..
Im using windows
Below solution worked for me
Copy mongorestore.exe to C:\Users\leo\Downloads\project folder
open command prompt C:\Users\leo\Downloads\project\ location
mongoservice.exe projectdbfiles\
it should work.

mongodump showing error: Error parsing command line: too many positional options

mongodump:
--host hostname:port -u User -p password--authenticationDatabase admin --dbdb_name --collection collection_name –q {db.getCollection('col_name').find({"statement.context.platform":"abc","statement.timestamp":{'$gte':'2016-03-30T00:00:00','$lte':'2016-04-20T23:59:59'}})}"
Error:
Error parsing command line: too many positional options
Mongodb version- 2.6
Spaces between arguments are not correct
https://docs.mongodb.com/manual/reference/program/mongodump/#cmdoption--query says:
You must enclose the query in single quotes (e.g. ') to ensure that it does not interact with your shell environment.
and your query doesn't have starting qoute, but it ends with double quote.
Hope that this helps.

Error when running mongodump

I have a rollback file, but when I run mongodump on it I get an error:
mongodump.exe .\test.foo.2016-04-27T16-49-54.0.bson > f.json
02:33.521+0100 positional arguments not allowed: [.\test.foo.2016-04-27T16-49-54.0.bson]
02:33.522+0100 try 'mongodump --help' for more information
You just used the wrong command. You have to use the bsondump command instead of the mongodump command. Mongodump is only for create of the backup file. From the parameters you provide in your command I assume that you want to convert the bson file to a human-readable json file.

MongoExport Too many positional options

Am trying to run a mongoexport using a remote connection by filtering on date ranges. A very simple query, however, I am running into positional errors issue. I;ve read through most of the posts regarding it, did the epoch conversion etc. But completely hit a block. Hopefully someone here can figure out what I am doing wrong.
Below is my command and the error message:
C:\ mongoexport --host 1.1.1.111:1111 --db IQ -u user -p password --collection CallLog --out calllog.json --query '{"Call.StartTime":{"$gte":new Date(1411066005000),"$lte": new Date(1406918805000)}}'
Error parsing command line: too many positional options
try 'mongoexport --help' for more information
We use the authenticationDatabase option when connecting and running queries from mongo. Tried the above using that as well. But same error.
What am I doing wrong here?
Thanks so much in advance.
Regards,
Simak
resolved this by interchanging the " and ' marks..Didn't realise that those made all the difference.
Thanks!