Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4446

How to access the oplog with authentication turned on

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 5.2.1
    • Component/s: None
    • None
    • Environment:
      QA

      This is more of a mongodb issue, but need to know if I need to change my mongoid.yml OR if there is some security/role that needs enabled for the myAdmin Id.
      Line in Ruby Code that is failing is highlighted in red. It appears this is a mongodb change in 3.4 where the local database is NOT accessible when security is enabled using the auth source below ( mongoid.yml ). Please advise ASAP. Thanks!

      Mongoid ( yml ) entry:
      development:
      clients:
      default:
      uri: mongodb://qa1-web-db1:33478,qa1-web-db2:33478,qa1-web-db3:33478/eventmgr
      options:
      read:
      mode: :primary_preferred
      user: myAdminId
      password: DONOTSHOW
      auth_mech: :scram
      auth_source: admin

      Ruby method that is failing ( line in red is failing ) :

      def oplog_entries

      1. Oplog client can be found from any valid collection on the same mongo server as the local database, use Command.
        client = ContentIntegrationHub::Command.mongo_client.with(database: 'local')
      2. Since this is a run-once thread, there's no need for a cursor. Just read the oplog since a time in the past.
        client['oplog.rs'].find({"ts" => {"$gte" => timestamp}}, sort: {'$natural' => 1})
        end

      *ERROR is: *Mongo::Error::OperationFailure: not authorized on local to execute command { find: "oplog.rs", filter: { ts:

      { $gte: Timestamp 1497449043000|0 }

      }, sort:

      { $natural: 1 }

      } (13)

            Assignee:
            Unassigned Unassigned
            Reporter:
            srodriguez@ofiglobal.com Steve Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: