Have been working on development on NodeBB for a while. It works fine with both local db and non-cluster Mongodb instances. However with a cluster on Atlas I am getting the following error:
not authorized on admin to execute command { create: "socket.io", capped: true, size: 5242880 } {"name":"MongoError","ok":0,"errmsg":"not authorized on admin to execute command { create: \"socket.io\", capped: true, size: 5242880 }","code":8000,"codeName":"AtlasError"}
Have been experimenting with set of different roles. Here, the user is assigned the following roles:
dbAdmin@somedbname
dbAdminAnyDatabase@admin
readWriteAnyDatabase@admin
enableSharding@admin
The database is hosted on Mongodb Atlas cluster.
{
"url": "http://localhost:4567",
"secret": "dc0b3fff-4312-1234-4321-e5a327824225",
"database": "mongo",
"port": "4567",
"mongo": {
"host": "cluster0-shard-00-00-z1243.mongodb.net,cluster0-shard-00-01-z1234.mongodb.net,cluster0-shard-00-02-z1234.mongodb.net",
"port": "27017,27017,27017",
"username": "dbUser",
"password": "1234123412341234",
"database": "somedbname",
"uri": "mongodb+srv://dbUser:1234123412341234@cluster0-z1234.mongodb.net/somedbname?replicaSet=Cluster0-00-01"
}
}
MongoDb npm package version: 3.2.3
MongoDb version on Atlas: 4.0.8
The error occurs when running the code in VSCode locally on dev machine with db connection string pointing at MongoDb Atlas.
I can successfully connect and work with a local instance of mongodb. The issue occurs only when connecting to Mongodb on Atlas.
Have also requested support directly from NodeBB community but did not get much from them.
Official Mongodb docs on what a connection to replicaset should look like.
from Not authorized on admin to execute command create socket.io. Code 8000. Codename AtlasError
No comments:
Post a Comment