Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16367

[SERVER] Audit Filter example does not work as displayed for findAndModify()

      Audit Filter examples on the following page, if they are copy pasted into a MongoDB configuration, will not produce the desired results for `findAndModify()` operations. If a customer copy pastes these examples into their environment and tests, they will not be successful.

      https://www.mongodb.com/docs/v5.0/tutorial/configure-audit-filters/#filter-on-read-and-write-operations

      • For all examples, where it is currently "findandmodify", needs to be changed to "findAndModify" for it to work. I found 6 examples on that page that need to be changed. 

       

      Please see updated examples with the correct case sensitivity:

      {    atype: "authCheck",    "param.command": \{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }

       

      mongod --dbpath data/db --auth --setParameter auditAuthorizationSuccess=true --auditDestination file --auditFilter '{ atype: "authCheck", "param.command":

      { $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }' --auditFormat BSON --auditPath data/db/auditLog.bson

       
      storage:
         dbPath: data/db
      security:
         authorization: enabled
      auditLog:
         destination: file
         format: BSON
         path: data/db/auditLog.bson
         filter: '{ atype: "authCheck", "param.command":

      { $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }'
      setParameter: { auditAuthorizationSuccess: true }
       

      {     atype: "authCheck",     "param.ns": "test.orders",     "param.command": \{ $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }
       
      mongod --dbpath data/db --auth --setParameter auditAuthorizationSuccess=true --auditDestination file --auditFilter '{ atype: "authCheck", "param.ns": "test.orders", "param.command":

      { $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }' --auditFormat BSON --auditPath data/db/auditLog.bson
       
      storage:
         dbPath: data/db
      security:
         authorization: enabled
      auditLog:
         destination: file
         format: BSON
         path: data/db/auditLog.bson
         filter: '{ atype: "authCheck", "param.ns": "test.orders", "param.command":

      { $in: [ "find", "insert", "delete", "update", "findAndModify" ] }

      }'
      setParameter: { auditAuthorizationSuccess: true }

            Assignee:
            lauren.tran@mongodb.com Lauren Tran
            Reporter:
            zynon.putney@mongodb.com Zynon Putney
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              34 weeks, 6 days ago