Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1707

Driver overwrites database from uri with authSource from options

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.1.8
    • Affects Version/s: Not Applicable
    • Component/s: 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@mongodb.com Matt Broadstone
            Reporter:
            imsamurai imsamurai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: