Skip to content
Advertisement

pymongo auth failed in python script

I have installed mongodb and enabled auth. and its working find. I can connect it from remote notebook using robomongo application:

JavaScript

and We can connect from server shell locally using:

JavaScript

Everything works fine, but when we try it using pymongo api. authentications failed. below is the python code:

JavaScript

Tools used:

JavaScript

Error trace:

JavaScript

Solution: problem was with database name, following code works fine:

JavaScript

Advertisement

Answer

Please try something like this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement