I am trying to import some json files to mongodb collections using following command on a server other than mongodb server:
mongoimport --host IP --port 27017 -u myuser -p mypass --authenticationDatabase admin --db dbname --collection collection --drop --type json --file absolutejsonfilepath --jsonArray
It is throwing following error:
server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
How ever If I hit the same command on mongodb server itself then it works. I have checked all credentials & other details. All details are correct.
version
mongodb version: 5.0.8
update
if I run the command using -vvvv parameter (for verbose output) then I got this:
2022-05-12T12:29:22.261+0000 checking options
2022-05-12T12:29:22.262+0000 dumping with object check disabled
2022-05-12T12:29:22.262+0000 will listen for SIGTERM, SIGINT, and SIGKILL
2022-05-12T12:29:22.283+0000 got error from options parsing: error connecting to db server: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
2022-05-12T12:29:22.283+0000 Failed: error connecting to db server: server returned error on SASL authentication step: BSON field 'saslContinue.mechanism' is an unknown field.
After spending hours, I came to know that it was mongoimport version issue on host server. The mongoimport was installed without version number & hence went into errors.
I used following commands to install mongodb tools version 100.5.1
sudo apt-get --purge remove mongodb-org
sudo apt purge mongodb*
sudo dpkg -i --force-all mongodb-database-tools-ubuntu2004-x86_64-100.5.1.deb