Chapter 3: Sharding Lab: Shard a Collection authentication error

I tried to import the file with this command .

mongoimport --port=27004 -u=m103-admin -p=m103-pass -c=products -d=m103  --file=/dataset/products.json 

Afterwards,I got authentification error.

2022-05-23T20:19:03.392+0000    error connecting to host: could not connect to server: connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

Use authenticationDatabase as admin and try again

1 Like

I tried to put in that command authenticationDatabase admin.

mongoimport --username "m103-admin" --password "m103-pass" --authenticationDatabase "admin" --db "m103" --collection "products" --port 27004 /dataset/products.json

Afterwards,I got a json file which said more than once.

2022-05-25T18:45:33.605+0000    connected to: mongodb://localhost:27004/
2022-05-25T18:45:33.774+0000    Failed: bulk write error: [{[{can't create user databases on a --configsvr instance} ,...}}]

Please see in this other thread