full-balloon-75621
07/21/2021, 2:07 AMsource:
type: "mongodb"
config:
connect_uri: "<mongodb://my.hostname:27017/mydb>"
username: "readonly"
password: "readonly"
env: "DEV"
authMechanism: "DEFAULT"
options:
tls: True
tlsCAFile: "/path/to/my.pem"
I suspect the account can't access the "default" database, but putting database on the uri didn't help. Any suggestions?gray-shoe-75895
07/21/2021, 3:11 AMgray-shoe-75895
07/21/2021, 3:11 AMfull-balloon-75621
07/21/2021, 4:00 AMfrom pymongo import MongoClient
from pprint import pprint
import urllib.parse
username = urllib.parse.quote_plus('readonly')
password = urllib.parse.quote_plus('readonly')
uri = 'mongodb://' + username + ':' + password + '@my.hostname:27017/mydb?tls=true&tlsCAFile=/path/to/my.pem'
client = MongoClient(uri)
db = client.student
pprint(db.my_collection.find_one())full-balloon-75621
07/22/2021, 2:31 AMdatabase_names: List[str] = client.list_database_names(). I guess this confirms further privileges are needed...full-balloon-75621
07/22/2021, 2:47 AMreadAnyDatabase role solved the issue. Thanks!gray-shoe-75895
07/22/2021, 6:02 PMgray-shoe-75895
07/22/2021, 6:02 PM