Trying to import a JSON file
Mongodb Version -- V3.6.3
Shell Version 3.6
Using this command to connect to cluster and import
mongoimport --host cluster0-shard-00-00-xxm0e.mongodb.net:24537 --db ny --type json --file C:/data/docs/ny.json --jsonArray --authenticationDatabase admin --ssl --username xyz --password mongodb
error message
2018-03-03T22:53:45.477-0800 no collection specified
2018-03-03T22:53:45.478-0800 using filename 'ny' as collection
2018-03-03T22:53:46.062-0800 Failed: error connecting to db server: server` returned error on SASL authentication step: bad auth Authentication failed.
2018-03-03T22:53:46.062-0800 imported 0 documents
Have tried a few options like removing -ssl adding ----sslAllowInvalidCertificates Adding " C:/data/docs/ny.json" to file name and none of these works.. Any help appreciated
You have to specify the collection -c or --collection
flag. see official docs.
mongoimport
--host <HOST>
--ssl --username <USERNAME>
--password <PASSWORD>
--authenticationDatabase admin
--db <DATABASE>
--collection <COLLECTION>
--type <FILETYPE>
--file <FILENAME>