-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: Not Applicable
-
Component/s: None
-
Empty show more show less
Configuration:
- user execute query in "DB_query"
- user authorization stored in "DB_auth" (user has no acces to that db)
- config:
url: mongodb://user:password@host:port/DB_query
options: {"authSource": "DB_auth"}
const client = await MongoClient.connect(url, options);
const result = await client.db().collection(collection).find(query, fields);
Expected: query executed in "DB_query"
Actual: query executed in "DB_auth"
This thing seems caused by this change i get error "MongoError: not authorized on DB_auth to execute command".
Db in url is differ than than authSource, after latest upgrade driver try to execute query in authSource instead of db specified in url.
Behavior exists in 3.x and 4.x mongodb, standalone and replica set
- is duplicated by
-
NODE-1708 Using useNewUrlParser: true prevents db name from connection string from being applied
- Closed