saeeed
February 18, 2021, 8:13am
1
Hello to all .
I enabled authentication because I want to access my server database remotely.
And I created a user for my meteor database with the following information:
use meteor
db.createUser({
user: 'user',
pwd: 'secretPassword',
roles: [{ role: 'readWrite', db:'meteor'}]
})
Now I can easily remotely access the database from outside the server: from vscode :
and this is success
But my meteor software itself has a problem and can not connect to the database
I tried the following methods:
"MONGO_URL": "mongodb://user:secretPassword@127.0.0.1:27017/meteor",
"MONGO_OPLOG_URL": "mongodb://user:secretPassword@127.0.0.1:27017/local",
"MONGO_URL": "mongodb://user:secretPassword@194.5.195.113:27017/meteor",
"MONGO_OPLOG_URL": "mongodb://user:secretPassword@194.5.195.113:27017/local",
And other combinations
But it does not work.
Please Guide me
Does it work without MONGO_OPLOG_URL
?
saeeed
February 18, 2021, 9:05am
3
I did two things to make it work:
First, I gave the user I created access to the local
database, and I created the user this way from the beginning:
db.createUser({
user: 'user',
pwd: 'secretPassword',
roles: [
{ role: 'readWrite', db:'meteor'},
{ role: 'readWrite', db:'local'}
]
})
Second, I set MONGO_URL
and MONGO_OPLOG_URL
like this :
And I do not know exactly what MONGO_OPLOG_URL
does
"MONGO_URL": "mongodb://user:secretPassword@127.0.0.1:27017/meteor?authSource=meteor",
"MONGO_OPLOG_URL": "mongodb://user:secretPassword@127.0.0.1:27017/local?authSource=meteor",
I do not know exactly what the problem is, but it was fully explained in the link below :
https://stackoverflow.com/questions/31398367/authentication-in-mongoose-using-scram-sha-1
That looks right. I think you could get away with having the role to local
DB be just read
.
1 Like