Lab: Shard a Collection

I have created my second replication set, I added it to the shard, but when I go to drop the database I get an error.

My question is whether this is done from the mongos terminal. I have tried to run it while logged into mongos, but of course that doesn’t work. I exited the shell program and tried to import it but I get the following:

"error validating settings: only one positional argument is allowed:

This is what I am typing from the vagrant prompt.

mongoimport --drop /dataset/products.json --port 26000 -u “m103-admin” \ -p “m103-pass” --authenticationDatabase “admin” \ --db m103 --collection products

I have double and triple checked my syntax and it appears to be right. (although the \ character seems to be in a different place than the last import statement)


Mongoimport is a command line tool, not a MongoDB command. So it’s NOT in the mongo prompt, but on the Linux prompt.

Also, if you’re writing it all on one line, you do not need to add the slashes. It’s a bit silly MongoU left those in :confused:

Aside from that your command looks fine.


Try by moving /dataset/products.json as the last argument of the command line. I think that’s what it means with the error “only one positional argument is allowed”

Also, you should not have backslashes in the middle of the command. You put a backslash when you want to enter a command on multiple line and the backslash is at the end of the line.

Sorry, Tess_Sluijter
I saw your reply about backslash and single line after I sent mine, so it looks like I am repeating but I was too quick with the mouse and keyboard and slow with my brain.

Thanks ALL !!! I dropped the \ and it worked like a champ!!

Thank you! I kept putting it in the mongoshell on my mongos. This really helped :slight_smile:

@steevej-1495 - Hi, i am in the dataset folder and using this comment but this is the erro.
where am i wrong