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

Setting a filter with db.setProfilingLevel(2) is not working

      Hello team,

      The below example is misleading, I have found out that this example is not working.

       

      For example, the following db.setProfilingLevel() method sets for a mongod instance:

      • the profiling level to 2,
      • the filter of { op: "query", millis: { $gt: 2000 }}, which causes the profiler to only log query operations that took longer than 2 seconds.
      db.setProfilingLevel( 2, { filter: { op: "query", millis: { $gt: 2000 } } } )

      To me, the filter for Data Profiler works with db.setProfilingLevel( 1 ) only.

      db.setProfilingLevel( 1, { filter: { op: "query", millis: { $gt: 2000 } } } )

       

      Which makes sense with the below description 

       

      Level Description
      0 The profiler is off and does not collect any data. This is the default profiler level.
      1 The profiler collects data for operations that take longer than the value of slowms or that match a filter.
      When a filter is set:
      • The slowms and sampleRate options are not used for profiling.
      • The profiler only captures operations that match the filter.
      2 The profiler collects data for all operations.

       

      https://www.mongodb.com/docs/manual/tutorial/manage-the-database-profiler/#database-profiler

      Can you please check this out and rectify the example?

            Assignee:
            jason.price@mongodb.com Jason Price
            Reporter:
            peter.oh@mongodb.com Peter Oh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              1 year, 45 weeks, 5 days ago