I tried to connect the MongoDB with username and password, though username and password are correct still I am getting authorization error.
Asked
Active
Viewed 140 times
0
-
Change database to any other database as you don't have access to `admin` database. – Tushar Gupta - curioustushar Mar 30 '21 at 16:29
-
@TusharGupta-curioustushar I tried the same connection in my code with same db credentials to test and its working as expected – Priyanka Mar 30 '21 at 16:33
-
Can you try with another database name on `node-red` ? – Tushar Gupta - curioustushar Mar 30 '21 at 16:34
-
1Please don't paste screenshots. Use formatted text for error, see https://meta.stackoverflow.com/a/285557/3027266 – Wernfried Domscheit Mar 30 '21 at 16:40
-
The error is quite clear, you have no permissions to execute the command. See [Built-In Roles](https://docs.mongodb.com/manual/reference/built-in-roles/index.html) which roles grants execute of `listCollections` – Wernfried Domscheit Mar 30 '21 at 16:42
-
@TusharGupta-curioustushar yup tried , but failed .. and this problem I am facing only with db which have username and password authentication – Priyanka Mar 30 '21 at 16:43
-
@WernfriedDomscheit I can able to connect with same db credentials from my code or from robomongo or mlab , if I dont have any permission for that db how its getting connected from robomongo ? – Priyanka Mar 30 '21 at 16:49
-
Typically you have to specify two databases. The authentication database and the database you like to use, see https://stackoverflow.com/questions/63754742/authentication-failure-while-trying-to-save-to-mongodb/63755470#63755470 Perhaps Node-RED is not that smart. – Wernfried Domscheit Mar 30 '21 at 17:50
-
Which NR add-on are you using? It works for me using `node-red-contrib-mongodb3`. And I assume you have a record in the `system.users` collection of the `admin` database to give you access. – Michael Mar 31 '21 at 02:14