Mongoimport: Sharing output as it doesn't quite match with what it says

I am using Ubuntu 16.04 on virtualbox. I’ve installed MongoDB server 4.0 and have just enabled authentication, created admin user with localhost exception.

I am importing a dataset with mongoimport. The command I’ve used and the output it gave is this:

Expected output is obvious, it shouldn’t import as it requires authentication (I forgot to supply username and password) and it’s not imported so that’s fine.

But one thing to notice here are the logs printed on the command line!

It says 58.9% completed, 100.0% completed and finally “imported 18000 documents”.

Is it correct message even though it’s been failed to import?

Just wanted to share as I came across this instance.

Tested it on Windows
Noted same observation

Without access control enabled the command works and import is successful
With access control enabled it fails though log shows imported docs

2020-08-28T07:44:21.062+0530 num failures: 474
2020-08-28T07:44:21.062+0530 error inserting documents: command insert requires authentication
2020-08-28T07:44:21.062+0530 imported 50000 documents

1 Like