Driver overwrites database from uri with authSource from options

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.1.8
    • Affects Version/s: Not Applicable
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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

              Assignee:
              Matt Broadstone
              Reporter:
              imsamurai
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: