<section>
 <h1 class="contains-headerlink leafygreen-ui-41fr9s" weight="medium">
  db.setProfilingLevel()
  <a class="headerlink leafygreen-ui-1kepx47" href="#db.setprofilinglevel--" title="Permalink to this heading">
   <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
    <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
    </path>
    <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
    </path>
   </svg>
   <div class="css-1btu0w3 evvkmar0" id="db.setprofilinglevel--">
   </div>
  </a>
 </h1>
 <div class="leafygreen-ui-a5yxub">
  <p class="css-1cmx2d4 ef7gu8j0">
   On this page
  </p>
  <ul class="css-1qb0mst ef7gu8j1">
   <li class="leafygreen-ui-1e7a0ei">
    <a class="lg-ui-0001 leafygreen-ui-e98ikf" href="#definition" target="_self">
     <span>
      Definition
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#syntax" target="_self">
     <span>
      Syntax
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#parameters" target="_self">
     <span>
      Parameters
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#returns" target="_self">
     <span>
      Returns
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-cpmeq5" href="#behavior" target="_self">
     <span>
      Behavior
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-cpmeq5" href="#examples" target="_self">
     <span>
      Examples
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#enable-profiler-and-set-slow-operation-threshold-and-sample-rate" target="_self">
     <span>
      Enable Profiler and Set Slow Operation Threshold and Sample Rate
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#disable-profiler-and-set-slow-operation-threshold-and-sample-rate" target="_self">
     <span>
      Disable Profiler and Set Slow Operation Threshold and Sample Rate
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#set-a-filter-to-determine-profiled-operations" target="_self">
     <span>
      Set a Filter to Determine Profiled Operations
     </span>
    </a>
   </li>
   <li class="leafygreen-ui-1jqtqlb">
    <a class="lg-ui-0001 leafygreen-ui-x9koo9" href="#unset-a-filter" target="_self">
     <span>
      Unset a Filter
     </span>
    </a>
   </li>
  </ul>
 </div>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Definition
   <a class="headerlink leafygreen-ui-1kepx47" href="#definition" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="definition">
    </div>
   </a>
  </h2>
  <dl class="method">
   <dt>
    <code class="leafygreen-ui-1l06pbn">
     db.setProfilingLevel(level, options)
    </code>
    <a class="headerlink leafygreen-ui-1kepx47" href="#mongodb-method-db.setProfilingLevel" title="Permalink to this definition">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="mongodb-method-db.setProfilingLevel">
     </div>
    </a>
   </dt>
   <dd>
    <div>
     <p>
      <em>
       Changed
       <!-- -->
       in version
       <!-- -->
       5.0
      </em>
      .
     </p>
    </div>
    <p class="leafygreen-ui-1kp3ins">
     For a
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
      <code class="leafygreen-ui-1l06pbn">
       mongod
      </code>
     </a>
     instance, the method enables, disables,
or configures the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/">
      Database Profiler
     </a>
     . The
profiler captures and records data on the performance of write
operations, cursors, and database commands on a running
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
      <code class="leafygreen-ui-1l06pbn">
       mongod
      </code>
     </a>
     instance. If the profiler is disabled, the
method configures how slow operations are logged to the diagnostic
log.
    </p>
    <div class="leafygreen-ui-15mdk4" role="note">
     <h2 class="leafygreen-ui-6n7b7d">
      Note
     </h2>
     <div class="leafygreen-ui-9mycqc">
      <p class="leafygreen-ui-1kp3ins">
       Changes made to the profiling level with
       <code class="leafygreen-ui-1l06pbn">
        db.setProfilingLevel()
       </code>
       do
       <em>
        not
       </em>
       persist.  When the server restarts, it reverts to
       <code class="leafygreen-ui-1l06pbn">
        0
       </code>
       (the default), or the value set by either the
       <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.mode">
        <code class="leafygreen-ui-1l06pbn">
         operationProfiling.mode
        </code>
       </a>
       setting or the
       <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#std-option-mongod.--profile">
        <code class="leafygreen-ui-1l06pbn">
         --profile
        </code>
       </a>
       command-line option.
      </p>
     </div>
    </div>
    <p class="leafygreen-ui-1kp3ins">
     If the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
      <span>
       database profiler level
      </span>
     </a>
     is
     <code class="leafygreen-ui-1l06pbn">
      1
     </code>
     or
     <code class="leafygreen-ui-1l06pbn">
      2
     </code>
     (specifically, the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/">
      database profiler
     </a>
     is enabled), the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
      <span>
       slowms
      </span>
     </a>
     ,
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
      <span>
       sampleRate
      </span>
     </a>
     affect
the behavior of both the profiler and the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#std-option-mongod.--logpath">
      <code class="leafygreen-ui-1l06pbn">
       diagnostic log
      </code>
      .
     </a>
    </p>
    <p class="leafygreen-ui-1kp3ins">
     If the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
      <span>
       database profiler level
      </span>
     </a>
     is
     <code class="leafygreen-ui-1l06pbn">
      0
     </code>
     (specifically,
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/">
      database profiler
     </a>
     is disabled), the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
      <span>
       slowms
      </span>
     </a>
     and
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
      <span>
       sampleRate
      </span>
     </a>
     , affect
only the diagnostic log.
    </p>
    <p class="leafygreen-ui-1kp3ins">
     With
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
      <code class="leafygreen-ui-1l06pbn">
       mongos
      </code>
     </a>
     instances, the
method sets the
     <code class="leafygreen-ui-1l06pbn">
      slowms
     </code>
     ,
     <code class="leafygreen-ui-1l06pbn">
      sampleRate
     </code>
     and
     <code class="leafygreen-ui-1l06pbn">
      filter
     </code>
     configuration settings, which configure how operations get written to
the diagnostic log. You cannot enable the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/">
      Database Profiler
     </a>
     on a
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
      <code class="leafygreen-ui-1l06pbn">
       mongos
      </code>
     </a>
     instance because
     <code class="leafygreen-ui-1l06pbn">
      mongos
     </code>
     does not have any
collections that the profiler can write to. The
     <code class="leafygreen-ui-1l06pbn">
      profile
     </code>
     level
must be
     <code class="leafygreen-ui-1l06pbn">
      0
     </code>
     for a
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
      <code class="leafygreen-ui-1l06pbn">
       mongos
      </code>
     </a>
     instance.
    </p>
    <p class="leafygreen-ui-1kp3ins">
     You can specify a
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
      <span>
       filter
      </span>
     </a>
     on both
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
      <code class="leafygreen-ui-1l06pbn">
       mongod
      </code>
     </a>
     and
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
      <code class="leafygreen-ui-1l06pbn">
       mongos
      </code>
     </a>
     instances to control which
operations are logged by the profiler. When you specify a
     <code class="leafygreen-ui-1l06pbn">
      filter
     </code>
     for the
profiler, the
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
      <span>
       slowms
      </span>
     </a>
     , and
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
      <span>
       sampleRate
      </span>
     </a>
     options
are not used for profiling and slow-query log lines.
    </p>
    <p class="leafygreen-ui-1kp3ins">
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#mongodb-method-db.setProfilingLevel" target="_self">
      <span>
       <code class="leafygreen-ui-1l06pbn">
        db.setProfilingLevel()
       </code>
      </span>
     </a>
     provides a wrapper around the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/profile/#mongodb-dbcommand-dbcmd.profile">
      <code class="leafygreen-ui-1l06pbn">
       profile
      </code>
     </a>
     command.
    </p>
    <p class="leafygreen-ui-1kp3ins">
     Starting in MongoDB 5.0, changes made to the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/#std-label-database-profiler">
      database profiler
     </a>
     <code class="leafygreen-ui-1l06pbn">
      level
     </code>
     ,
     <code class="leafygreen-ui-1l06pbn">
      slowms
     </code>
     ,
     <code class="leafygreen-ui-1l06pbn">
      sampleRate
     </code>
     , or
     <code class="leafygreen-ui-1l06pbn">
      filter
     </code>
     using the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/profile/#mongodb-dbcommand-dbcmd.profile">
      <code class="leafygreen-ui-1l06pbn">
       profile
      </code>
     </a>
     command or
     <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#mongodb-method-db.setProfilingLevel" target="_self">
      <span>
       <code class="leafygreen-ui-1l06pbn">
        db.setProfilingLevel()
       </code>
      </span>
     </a>
     wrapper method are recorded in the
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#std-option-mongod.--logpath">
      <code class="leafygreen-ui-1l06pbn">
       log file
      </code>
      .
     </a>
    </p>
   </dd>
  </dl>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Syntax
    <a class="headerlink leafygreen-ui-1kepx47" href="#syntax" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="syntax">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#mongodb-method-db.setProfilingLevel" target="_self">
     <span>
      <code class="leafygreen-ui-1l06pbn">
       db.setProfilingLevel()
      </code>
     </span>
    </a>
    method has the following form:
   </p>
   <script class="structured_data" type="application/ld+json">
    {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"db.setProfilingLevel(&lt;level&gt;, &lt;options&gt;)","programmingLanguage":"JavaScript"}
   </script>
   <div class="css-16lmvu9">
    <div class="leafygreen-ui-196mwvg">
     <div class="leafygreen-ui-yzcs8i">
      <pre class="leafygreen-ui-1q4bxgx" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">db.<span class="lg-highlight-title lg-highlight-function">setProfilingLevel</span>(&lt;<!-- -->level<!-- -->&gt;<!-- -->,<!-- --> <!-- -->&lt;<!-- -->options<!-- -->&gt;<!-- -->)</td></tr></tbody></table></code></pre>
      <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
       <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
        <div class="leafygreen-ui-xhlipt">
         <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
          <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
          </path>
         </svg>
        </div>
       </button>
      </div>
     </div>
    </div>
   </div>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Parameters
    <a class="headerlink leafygreen-ui-1kepx47" href="#parameters" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="parameters">
     </div>
    </a>
   </h3>
   <div class="leafygreen-ui-skkc39" tabindex="0">
    <table class="leafygreen-ui-hr8lsv">
     <colgroup>
      <col style="width:20%"/>
      <col style="width:20%"/>
      <col style="width:80%"/>
     </colgroup>
     <thead class="leafygreen-ui-a9ho40">
      <tr data-testid="leafygreen-ui-header-row">
       <th class="leafygreen-ui-1trtg6r" role="columnheader" scope="col">
        <div class="leafygreen-ui-ui0te9">
         <div>
          Parameter
         </div>
        </div>
       </th>
       <th class="leafygreen-ui-13uteka" role="columnheader" scope="col">
        <div class="leafygreen-ui-ui0te9">
         <div>
          Type
         </div>
        </div>
       </th>
       <th class="leafygreen-ui-13uteka" role="columnheader" scope="col">
        <div class="leafygreen-ui-ui0te9">
         <div>
          Description
         </div>
        </div>
       </th>
      </tr>
     </thead>
     <tbody>
      <tr class="">
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
           <span>
            level
           </span>
          </a>
         </div>
        </div>
       </td>
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          integer
         </div>
        </div>
       </td>
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          <span class="leafygreen-ui-1qnjd6d" id="std-label-set-profiling-level-level">
          </span>
          <p class="leafygreen-ui-1kp3ins">
           Configures the
           <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/">
            database profiler
           </a>
           level. The following
profiler levels are available:
          </p>
          <dl>
           <dt>
            <code class="leafygreen-ui-1l06pbn">
             0
            </code>
           </dt>
           <dd class="css-1ufxuu7">
            The profiler is off and does not collect any data.
This is the default profiler level.
           </dd>
           <dt>
            <code class="leafygreen-ui-1l06pbn">
             1
            </code>
           </dt>
           <dd class="css-1ufxuu7">
            <p class="leafygreen-ui-1kp3ins">
             The profiler collects data for operations that exceed the
             <code class="leafygreen-ui-1l06pbn">
              slowms
             </code>
             threshold or match a specified
             <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
              <span>
               filter
               <!-- -->
               .
              </span>
             </a>
            </p>
            <p class="leafygreen-ui-1kp3ins">
             When a filter is set:
            </p>
            <ul class="leafygreen-ui-rioki0">
             <li class="leafygreen-ui-d7p7b6">
              <p class="leafygreen-ui-1kp3ins">
               The
               <code class="leafygreen-ui-1l06pbn">
                slowms
               </code>
               and
               <code class="leafygreen-ui-1l06pbn">
                sampleRate
               </code>
               options are not used for
profiling.
              </p>
             </li>
             <li class="leafygreen-ui-d7p7b6">
              <p class="leafygreen-ui-1kp3ins">
               The profiler only captures operations that match the
               <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
                <span>
                 filter
                 <!-- -->
                 .
                </span>
               </a>
              </p>
             </li>
            </ul>
           </dd>
           <dt>
            <code class="leafygreen-ui-1l06pbn">
             2
            </code>
           </dt>
           <dd class="css-1ufxuu7">
            The profiler collects data for all operations.
           </dd>
          </dl>
          <p class="leafygreen-ui-1kp3ins">
           Because profiling is not available on
           <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
            <code class="leafygreen-ui-1l06pbn">
             mongos
            </code>
           </a>
           ,
           <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#mongodb-method-db.setProfilingLevel" target="_self">
            <span>
             <code class="leafygreen-ui-1l06pbn">
              db.setProfilingLevel()
             </code>
            </span>
           </a>
           cannot be used to set the profiling
level to a value other than
           <code class="leafygreen-ui-1l06pbn">
            0
           </code>
           on a
           <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
            <code class="leafygreen-ui-1l06pbn">
             mongos
            </code>
           </a>
           instance.
          </p>
         </div>
        </div>
       </td>
      </tr>
      <tr class="">
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options" target="_self">
           <span>
            options
           </span>
          </a>
         </div>
        </div>
       </td>
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          document or integer
         </div>
        </div>
       </td>
       <td class="leafygreen-ui-1drjk7h">
        <div class="leafygreen-ui-1n4j8xf">
         <div>
          <span class="leafygreen-ui-1qnjd6d" id="std-label-set-profiling-level-options">
          </span>
          <p class="leafygreen-ui-1kp3ins">
           Optional. Accepts an integer or an options document. If an integer value is
passed as the
           <code class="leafygreen-ui-1l06pbn">
            options
           </code>
           argument instead of a document, the value is
assigned to
           <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
            <span>
             slowms
            </span>
           </a>
           .
The following options are available:
          </p>
          <div class="leafygreen-ui-skkc39" tabindex="0">
           <table class="leafygreen-ui-hr8lsv">
            <colgroup>
             <col style="width:25%"/>
             <col style="width:75%"/>
            </colgroup>
            <thead class="leafygreen-ui-a9ho40">
            </thead>
            <tbody>
             <tr class="">
              <td class="leafygreen-ui-xejatx" role="rowheader">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
                  <span>
                   slowms
                  </span>
                 </a>
                </div>
               </div>
              </td>
              <td class="leafygreen-ui-1drjk7h">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <span class="leafygreen-ui-1qnjd6d" id="std-label-set-profiling-level-options-slowms">
                 </span>
                 <div class="line-block">
                  <div class="line">
                   Default: 100
                  </div>
                  <div class="line">
                   Type: integer
                  </div>
                 </div>
                 <p class="leafygreen-ui-1kp3ins">
                  The slow operation time threshold, in milliseconds. Operations that run
for longer than this threshold are considered
                  <em>
                   slow
                  </em>
                  .
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  Slow operations are logged based on
                  <code class="leafygreen-ui-1l06pbn">
                   workingMillis
                  </code>
                  , which is the
amount of time that MongoDB spends working on that operation. This means
that factors such as waiting for locks and flow control do not affect
whether an operation exceeds the slow operation threshold.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  When
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/parameters/#mongodb-parameter-param.logLevel">
                   <code class="leafygreen-ui-1l06pbn">
                    logLevel
                   </code>
                  </a>
                  is set to
                  <code class="leafygreen-ui-1l06pbn">
                   0
                  </code>
                  , MongoDB records
                  <em>
                   slow
                  </em>
                  operations to the diagnostic log at a rate determined by
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.slowOpSampleRate">
                   <code class="leafygreen-ui-1l06pbn">
                    slowOpSampleRate
                   </code>
                   .
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  At higher
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/parameters/#mongodb-parameter-param.logLevel">
                   <code class="leafygreen-ui-1l06pbn">
                    logLevel
                   </code>
                  </a>
                  settings, all operations appear in
the diagnostic log regardless of their latency with the following
exception: the logging of slow oplog entry messages by the
secondaries. The secondaries log only the slow oplog
entries; increasing the
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/parameters/#mongodb-parameter-param.logLevel">
                   <code class="leafygreen-ui-1l06pbn">
                    logLevel
                   </code>
                  </a>
                  does not log all
oplog entries.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
                   <code class="leafygreen-ui-1l06pbn">
                    mongod
                   </code>
                  </a>
                  instances, the setting affects both the
diagnostic log and, if enabled, the profiler.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                  </a>
                  instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                   .
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  This argument affects the same setting as the configuration
file option
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.slowOpThresholdMs">
                   <code class="leafygreen-ui-1l06pbn">
                    slowOpThresholdMs
                   </code>
                   .
                  </a>
                 </p>
                </div>
               </div>
              </td>
             </tr>
             <tr class="">
              <td class="leafygreen-ui-xejatx" role="rowheader">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
                  <span>
                   sampleRate
                  </span>
                 </a>
                </div>
               </div>
              </td>
              <td class="leafygreen-ui-1drjk7h">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <span class="leafygreen-ui-1qnjd6d" id="std-label-set-profiling-level-options-sampleRate">
                 </span>
                 <div class="line-block">
                  <div class="line">
                   Default: 1.0
                  </div>
                  <div class="line">
                   Type: double
                  </div>
                 </div>
                 <p class="leafygreen-ui-1kp3ins">
                  The fraction of
                  <em>
                   slow
                  </em>
                  operations that should be profiled or logged.
                  <code class="leafygreen-ui-1l06pbn">
                   sampleRate
                  </code>
                  accepts values between 0 and 1, inclusive.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
                   <code class="leafygreen-ui-1l06pbn">
                    mongod
                   </code>
                  </a>
                  instances, the setting affects both the
diagnostic log and, if enabled, the profiler.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                  </a>
                  instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                   .
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  This argument affects the same setting as the
configuration option
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.slowOpSampleRate">
                   <code class="leafygreen-ui-1l06pbn">
                    slowOpSampleRate
                   </code>
                   .
                  </a>
                 </p>
                </div>
               </div>
              </td>
             </tr>
             <tr class="">
              <td class="leafygreen-ui-xejatx" role="rowheader">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
                  <span>
                   filter
                  </span>
                 </a>
                </div>
               </div>
              </td>
              <td class="leafygreen-ui-1drjk7h">
               <div class="leafygreen-ui-1n4j8xf">
                <div>
                 <span class="leafygreen-ui-1qnjd6d" id="std-label-set-profiling-level-options-filter">
                 </span>
                 <p class="leafygreen-ui-1kp3ins">
                  Type: object
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  A filter expression that controls which operations are
profiled and logged. The field in the filter expression
can be
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/database-profiler/#std-label-profiler">
                   any field in the profiler output
                   <!-- -->
                   .
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
                   <code class="leafygreen-ui-1l06pbn">
                    mongod
                   </code>
                  </a>
                  instances, the setting affects both the
diagnostic log and, if enabled, the profiler.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                  </a>
                  instances, the setting affects
the diagnostic log only and not the profiler because
profiling is not available on
                  <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
                   <code class="leafygreen-ui-1l06pbn">
                    mongos
                   </code>
                   .
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  Starting in MongoDB 8.0, you can specify
                  <code class="leafygreen-ui-1l06pbn">
                   workingMillis
                  </code>
                  as a filter parameter to log operations based on the
amount of time MongoDB spends working on that operation.
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  For an example of a filter used to control logged
operations, see
                  <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-profiler-filter-example" target="_self">
                   <span>
                    Set a Filter to Determine Profiled Operations
                    <!-- -->
                    .
                   </span>
                  </a>
                 </p>
                 <p class="leafygreen-ui-1kp3ins">
                  When a profiling
                  <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
                   <span>
                    filter
                   </span>
                  </a>
                  is set, the
                  <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
                   <span>
                    slowms
                   </span>
                  </a>
                  and
                  <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
                   <span>
                    sampleRate
                   </span>
                  </a>
                  options do
not affect the diagnostic log or the profiler.
                 </p>
                </div>
               </div>
              </td>
             </tr>
            </tbody>
           </table>
          </div>
         </div>
        </div>
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Returns
    <a class="headerlink leafygreen-ui-1kepx47" href="#returns" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="returns">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The method returns a document that contains the
    <strong>
     previous
    </strong>
    values of
the settings.
   </p>
   <div aria-hidden="true">
   </div>
   <div class="leafygreen-ui-1b75luy" data-lgid="lg-tabs">
    <div class="leafygreen-ui-jp7pox" id="tabs-9">
     <div aria-label="Tabs to describe usage of mongos/repl-set/standalone" aria-orientation="horizontal" class="leafygreen-ui-m8p1vb lg-ui-tab-list-0000" data-lgid="lg-tabs-tab_list" role="tablist">
      <button aria-controls="_tvtiyzbgn" aria-selected="true" class="leafygreen-ui-1l773z1" data-text="" id="_cam4k5alh" name="" role="tab" tabindex="0">
       <div class="leafygreen-ui-1nxuzmg">
        Standalone
       </div>
      </button>
      <button aria-controls="_t5jot746l" aria-selected="false" class="leafygreen-ui-1ogxb8f" data-text="" id="_h1m52xf7x" name="" role="tab" tabindex="-1">
       <div class="leafygreen-ui-1nxuzmg">
        Replica Set Member
       </div>
      </button>
      <button aria-controls="_hpq7v5iaf" aria-selected="false" class="leafygreen-ui-1ogxb8f" data-text="" id="_tjzyoahes" name="" role="tab" tabindex="-1">
       <div class="leafygreen-ui-1nxuzmg">
        mongos Instance
       </div>
      </button>
     </div>
     <div class="leafygreen-ui-ov1ktg">
      <div class="leafygreen-ui-1sg2lsz">
      </div>
     </div>
    </div>
    <div class="lg-ui-tab-panels-0000" data-lgid="lg-tabs-tab_panels">
     <div>
      <div aria-labelledby="_wz3mfn2li" class="" id="_7gulb475z" role="tabpanel">
       <div class="leafygreen-ui-1kdmo88">
        <script class="structured_data" type="application/ld+json">
         {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"{\n   \"was\" : 2,\n   \"slowms\" : 100,\n   \"sampleRate\" : 1,\n   \"filter\" : {\n      \"$and\" : [\n         {\n            \"op\" : {\n               \"$eq\" : \"query\"\n            }\n         },\n         {\n            \"millis\" : {\n               \"$gt\" : 20000\n            }\n         }\n      ]\n   },\n   \"note\" : \"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.\",\n   \"ok\" : 1\n}","programmingLanguage":"JavaScript"}
        </script>
        <div class="css-16lmvu9">
         <div class="leafygreen-ui-196mwvg">
          <div class="leafygreen-ui-yzcs8i">
           <pre class="leafygreen-ui-11itue3" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"was"</span> <!-- -->: <span class="lg-highlight-number">2</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"slowms"</span> <!-- -->: <span class="lg-highlight-number">100</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"sampleRate"</span> <!-- -->: <span class="lg-highlight-number">1</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"filter"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"$and"</span> <!-- -->: <!-- -->[</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"op"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$eq"</span> <!-- -->: <span class="lg-highlight-string">"query"</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"millis"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$gt"</span> <!-- -->: <span class="lg-highlight-number">20000</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      ]</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"note"</span> <!-- -->: <span class="lg-highlight-string">"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines."</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"ok"</span> <!-- -->: <span class="lg-highlight-number">1</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">}</td></tr></tbody></table></code></pre>
           <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
            <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
             <div class="leafygreen-ui-xhlipt">
              <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
               <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
               </path>
              </svg>
             </div>
            </button>
           </div>
          </div>
         </div>
        </div>
       </div>
      </div>
     </div>
     <div>
      <div aria-labelledby="_la2mtkona" class="leafygreen-ui-38lglc" id="_j4c218ei0" role="tabpanel">
       <div class="leafygreen-ui-1kdmo88">
        <script class="structured_data" type="application/ld+json">
         {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"{\n   \"was\" : 0,\n   \"slowms\" : 100,\n   \"sampleRate\" : 1,\n   \"filter\" : {\n      \"$and\" : [\n         {\n            \"op\" : {\n               \"$eq\" : \"query\"\n            }\n         },\n         {\n            \"millis\" : {\n               \"$gte\" : 2000\n            }\n         }\n      ]\n   },\n   \"note\" : \"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.\",\n   \"ok\" : 1,\n   \"$clusterTime\" : {\n      \"clusterTime\" : Timestamp(1572991238, 1),\n      \"signature\" : {\n         \"hash\" : BinData(0,\"hg6GnlrVhV9MAhwWdeHmHQ4T4qU=\"),\n         \"keyId\" : NumberLong(\"6755945537557495811\")\n      }\n   },\n   \"operationTime\" : Timestamp(1572991238, 1)\n}","programmingLanguage":"JavaScript"}
        </script>
        <div class="css-16lmvu9">
         <div class="leafygreen-ui-196mwvg">
          <div class="leafygreen-ui-yzcs8i">
           <pre class="leafygreen-ui-11itue3" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"was"</span> <!-- -->: <span class="lg-highlight-number">0</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"slowms"</span> <!-- -->: <span class="lg-highlight-number">100</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"sampleRate"</span> <!-- -->: <span class="lg-highlight-number">1</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"filter"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"$and"</span> <!-- -->: <!-- -->[</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"op"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$eq"</span> <!-- -->: <span class="lg-highlight-string">"query"</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"millis"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$gte"</span> <!-- -->: <span class="lg-highlight-number">2000</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      ]</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"note"</span> <!-- -->: <span class="lg-highlight-string">"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines."</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"ok"</span> <!-- -->: <span class="lg-highlight-number">1</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"$clusterTime"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"clusterTime"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">Timestamp</span>(<span class="lg-highlight-number">1572991238</span>, <span class="lg-highlight-number">1</span>)<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"signature"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <span class="lg-highlight-string">"hash"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">BinData</span>(<span class="lg-highlight-number">0</span>,<span class="lg-highlight-string">"hg6GnlrVhV9MAhwWdeHmHQ4T4qU="</span>)<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <span class="lg-highlight-string">"keyId"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">NumberLong</span>(<span class="lg-highlight-string">"6755945537557495811"</span>)</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"operationTime"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">Timestamp</span>(<span class="lg-highlight-number">1572991238</span>, <span class="lg-highlight-number">1</span>)</td></tr><tr class=""><td class="leafygreen-ui-7razhx">}</td></tr></tbody></table></code></pre>
           <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
            <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
             <div class="leafygreen-ui-xhlipt">
              <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
               <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
               </path>
              </svg>
             </div>
            </button>
           </div>
          </div>
         </div>
        </div>
       </div>
      </div>
     </div>
     <div>
      <div aria-labelledby="_bf3v5tob3" class="leafygreen-ui-38lglc" id="_18vnjomnj" role="tabpanel">
       <div class="leafygreen-ui-1kdmo88">
        <script class="structured_data" type="application/ld+json">
         {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"{\n   \"was\" : 0,\n   \"slowms\" : 100,\n   \"sampleRate\" : 1,\n   \"filter\" : {\n      \"$and\" : [\n         {\n            \"op\" : {\n               \"$eq\" : \"query\"\n            }\n         },\n         {\n            \"millis\" : {\n               \"$gte\" : 2000\n            }\n         }\n      ]\n   },\n   \"note\" : \"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.\",\n   \"ok\" : 1,\n   \"operationTime\" : Timestamp(1572991499, 2),\n   \"$clusterTime\" : {\n      \"clusterTime\" : Timestamp(1572991499, 2),\n      \"signature\" : {\n         \"hash\" : BinData(0,\"nhCquIxUw7thlrBudXe3PnsnvP0=\"),\n         \"keyId\" : NumberLong(\"6755946491040235540\")\n      }\n   }\n}","programmingLanguage":"JavaScript"}
        </script>
        <div class="css-16lmvu9">
         <div class="leafygreen-ui-196mwvg">
          <div class="leafygreen-ui-yzcs8i">
           <pre class="leafygreen-ui-11itue3" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"was"</span> <!-- -->: <span class="lg-highlight-number">0</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"slowms"</span> <!-- -->: <span class="lg-highlight-number">100</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"sampleRate"</span> <!-- -->: <span class="lg-highlight-number">1</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"filter"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"$and"</span> <!-- -->: <!-- -->[</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"op"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$eq"</span> <!-- -->: <span class="lg-highlight-string">"query"</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">            <span class="lg-highlight-string">"millis"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">               <span class="lg-highlight-string">"$gte"</span> <!-- -->: <span class="lg-highlight-number">2000</span></td></tr><tr class=""><td class="leafygreen-ui-7razhx">            }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      ]</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   }<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"note"</span> <!-- -->: <span class="lg-highlight-string">"When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines."</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"ok"</span> <!-- -->: <span class="lg-highlight-number">1</span>,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"operationTime"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">Timestamp</span>(<span class="lg-highlight-number">1572991499</span>, <span class="lg-highlight-number">2</span>)<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   <span class="lg-highlight-string">"$clusterTime"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"clusterTime"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">Timestamp</span>(<span class="lg-highlight-number">1572991499</span>, <span class="lg-highlight-number">2</span>)<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      <span class="lg-highlight-string">"signature"</span> <!-- -->: <!-- -->{</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <span class="lg-highlight-string">"hash"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">BinData</span>(<span class="lg-highlight-number">0</span>,<span class="lg-highlight-string">"nhCquIxUw7thlrBudXe3PnsnvP0="</span>)<!-- -->,</td></tr><tr class=""><td class="leafygreen-ui-7razhx">         <span class="lg-highlight-string">"keyId"</span> <!-- -->: <span class="lg-highlight-title lg-highlight-class">NumberLong</span>(<span class="lg-highlight-string">"6755946491040235540"</span>)</td></tr><tr class=""><td class="leafygreen-ui-7razhx">      }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">   }</td></tr><tr class=""><td class="leafygreen-ui-7razhx">}</td></tr></tbody></table></code></pre>
           <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
            <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
             <div class="leafygreen-ui-xhlipt">
              <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
               <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
               </path>
              </svg>
             </div>
            </button>
           </div>
          </div>
         </div>
        </div>
       </div>
      </div>
     </div>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    Where:
   </p>
   <ul class="leafygreen-ui-rioki0">
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      <code class="leafygreen-ui-1l06pbn">
       was
      </code>
      is the
      <strong>
       previous
      </strong>
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
       <span>
        level
       </span>
      </a>
      setting.
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      <code class="leafygreen-ui-1l06pbn">
       slowms
      </code>
      is the
      <strong>
       previous
      </strong>
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
       <span>
        slowms
       </span>
      </a>
      setting.
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      <code class="leafygreen-ui-1l06pbn">
       sampleRate
      </code>
      is the
      <strong>
       previous
      </strong>
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
       <span>
        sampleRate
       </span>
      </a>
      setting.
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      <code class="leafygreen-ui-1l06pbn">
       filter
      </code>
      is the
      <strong>
       previous
      </strong>
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
       <span>
        filter
       </span>
      </a>
      setting.
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      <code class="leafygreen-ui-1l06pbn">
       note
      </code>
      is a string explaining the behavior of
      <code class="leafygreen-ui-1l06pbn">
       filter
      </code>
      . This field
only appears in the output when
      <code class="leafygreen-ui-1l06pbn">
       filter
      </code>
      is also present.
     </p>
    </li>
   </ul>
   <div class="leafygreen-ui-15mdk4" role="note">
    <h2 class="leafygreen-ui-6n7b7d">
     Note
    </h2>
    <div class="leafygreen-ui-9mycqc">
     <p class="leafygreen-ui-1kp3ins">
      The
      <code class="leafygreen-ui-1l06pbn">
       filter
      </code>
      and
      <code class="leafygreen-ui-1l06pbn">
       note
      </code>
      fields only appear in the output if
they were present in the previous
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
       <span>
        level
       </span>
      </a>
      setting.
     </p>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    To view the current profiling level, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.getProfilingStatus/#mongodb-method-db.getProfilingStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.getProfilingStatus()
     </code>
     .
    </a>
   </p>
  </section>
 </section>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Behavior
   <a class="headerlink leafygreen-ui-1kepx47" href="#behavior" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="behavior">
    </div>
   </a>
  </h2>
  <div class="leafygreen-ui-1sjx7ru" role="note">
   <h2 class="leafygreen-ui-29m78u">
    Warning
   </h2>
   <div class="leafygreen-ui-9mycqc">
    <p class="leafygreen-ui-1kp3ins">
     Profiling can degrade performance and expose unencrypted query data in the
system log. Carefully consider any performance and security implications
before configuring and enabling the profiler on a production deployment.
    </p>
    <p class="leafygreen-ui-1kp3ins">
     See
     <a class="leafygreen-ui-tqgtui" href="/docs/manual/tutorial/manage-the-database-profiler/#std-label-database-profiling-overhead">
      Profiler Overhead
     </a>
     for more information on
potential performance degradation.
    </p>
   </div>
  </div>
 </section>
 <section>
  <h2 class="contains-headerlink leafygreen-ui-19f71ei" weight="medium">
   Examples
   <a class="headerlink leafygreen-ui-1kepx47" href="#examples" title="Permalink to this heading">
    <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
     <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
     </path>
     <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
     </path>
    </svg>
    <div class="css-1btu0w3 evvkmar0" id="examples">
    </div>
   </a>
  </h2>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Enable Profiler and Set Slow Operation Threshold and Sample Rate
    <a class="headerlink leafygreen-ui-1kepx47" href="#enable-profiler-and-set-slow-operation-threshold-and-sample-rate" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="enable-profiler-and-set-slow-operation-threshold-and-sample-rate">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The following example sets for a
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
     <code class="leafygreen-ui-1l06pbn">
      mongod
     </code>
    </a>
    instance:
   </p>
   <ul class="leafygreen-ui-rioki0">
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
       <span>
        profiling level
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       1
      </code>
      ,
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the slow operation threshold
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
       <span>
        slowms
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       20
      </code>
      milliseconds, and
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
       <span>
        sampleRate
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       0.42
      </code>
      .
     </p>
    </li>
   </ul>
   <script class="structured_data" type="application/ld+json">
    {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"db.setProfilingLevel(1, { slowms: 20, sampleRate: 0.42 })","programmingLanguage":"JavaScript"}
   </script>
   <div class="css-16lmvu9">
    <div class="leafygreen-ui-196mwvg">
     <div class="leafygreen-ui-yzcs8i">
      <pre class="leafygreen-ui-1q4bxgx" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">db.<span class="lg-highlight-title lg-highlight-function">setProfilingLevel</span>(<span class="lg-highlight-number">1</span>, <!-- -->{ <span class="lg-highlight-attr">slowms</span>: <span class="lg-highlight-number">20</span>, <span class="lg-highlight-attr">sampleRate</span>: <span class="lg-highlight-number">0.42</span> })</td></tr></tbody></table></code></pre>
      <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
       <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
        <div class="leafygreen-ui-xhlipt">
         <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
          <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
          </path>
         </svg>
        </div>
       </button>
      </div>
     </div>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    The operation returns a document with the
    <strong>
     previous
    </strong>
    values for the
settings.
   </p>
   <p class="leafygreen-ui-1kp3ins">
    To view the current profiling level, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.getProfilingStatus/#mongodb-method-db.getProfilingStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.getProfilingStatus()
     </code>
     .
    </a>
   </p>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Disable Profiler and Set Slow Operation Threshold and Sample Rate
    <a class="headerlink leafygreen-ui-1kepx47" href="#disable-profiler-and-set-slow-operation-threshold-and-sample-rate" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="disable-profiler-and-set-slow-operation-threshold-and-sample-rate">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The following example sets for a
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
     <code class="leafygreen-ui-1l06pbn">
      mongod
     </code>
    </a>
    or
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongos/#mongodb-binary-bin.mongos">
     <code class="leafygreen-ui-1l06pbn">
      mongos
     </code>
    </a>
    instance:
   </p>
   <ul class="leafygreen-ui-rioki0">
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
       <span>
        profiling level
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       0
      </code>
      ,
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the slow operation threshold
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-slowms" target="_self">
       <span>
        slowms
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       20
      </code>
      milliseconds, and
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-sampleRate" target="_self">
       <span>
        sampleRate
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       0.42
      </code>
      .
     </p>
    </li>
   </ul>
   <script class="structured_data" type="application/ld+json">
    {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"db.setProfilingLevel(0, { slowms: 20, sampleRate: 0.42 })","programmingLanguage":"JavaScript"}
   </script>
   <div class="css-16lmvu9">
    <div class="leafygreen-ui-196mwvg">
     <div class="leafygreen-ui-yzcs8i">
      <pre class="leafygreen-ui-1q4bxgx" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">db.<span class="lg-highlight-title lg-highlight-function">setProfilingLevel</span>(<span class="lg-highlight-number">0</span>, <!-- -->{ <span class="lg-highlight-attr">slowms</span>: <span class="lg-highlight-number">20</span>, <span class="lg-highlight-attr">sampleRate</span>: <span class="lg-highlight-number">0.42</span> })</td></tr></tbody></table></code></pre>
      <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
       <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
        <div class="leafygreen-ui-xhlipt">
         <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
          <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
          </path>
         </svg>
        </div>
       </button>
      </div>
     </div>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    The operation returns a document with the
    <strong>
     previous
    </strong>
    values for the
settings.
   </p>
   <p class="leafygreen-ui-1kp3ins">
    To view the current profiling level, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.getProfilingStatus/#mongodb-method-db.getProfilingStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.getProfilingStatus()
     </code>
     .
    </a>
   </p>
   <span class="leafygreen-ui-1qnjd6d" id="std-label-profiler-filter-example">
   </span>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Set a Filter to Determine Profiled Operations
    <a class="headerlink leafygreen-ui-1kepx47" href="#set-a-filter-to-determine-profiled-operations" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="set-a-filter-to-determine-profiled-operations">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    The following example sets for a
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/program/mongod/#mongodb-binary-bin.mongod">
     <code class="leafygreen-ui-1l06pbn">
      mongod
     </code>
    </a>
    instance:
   </p>
   <ul class="leafygreen-ui-rioki0">
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      the
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-level" target="_self">
       <span>
        profiling level
       </span>
      </a>
      to
      <code class="leafygreen-ui-1l06pbn">
       1
      </code>
      ,
     </p>
    </li>
    <li class="leafygreen-ui-d7p7b6">
     <p class="leafygreen-ui-1kp3ins">
      a
      <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="#std-label-set-profiling-level-options-filter" target="_self">
       <span>
        filter
       </span>
      </a>
      of
      <code class="leafygreen-ui-1l06pbn">
       { op: "query", millis: { $gt: 2000 } }
      </code>
      , which causes the profiler
to only record
      <code class="leafygreen-ui-1l06pbn">
       query
      </code>
      operations that took longer than 2 seconds.
     </p>
    </li>
   </ul>
   <script class="structured_data" type="application/ld+json">
    {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"db.setProfilingLevel( 1, { filter: { op: \"query\", millis: { $gt: 2000 } } } )","programmingLanguage":"JavaScript"}
   </script>
   <div class="css-16lmvu9">
    <div class="leafygreen-ui-196mwvg">
     <div class="leafygreen-ui-1b1bvay">
      <pre class="leafygreen-ui-1q4bxgx" tabindex="0"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">db.<span class="lg-highlight-title lg-highlight-function">setProfilingLevel</span>( <span class="lg-highlight-number">1</span>, <!-- -->{ <span class="lg-highlight-attr">filter</span>: <!-- -->{ <span class="lg-highlight-attr">op</span>: <span class="lg-highlight-string">"query"</span>, <span class="lg-highlight-attr">millis</span>: <!-- -->{ <span class="lg-highlight-attr">$gt</span>: <span class="lg-highlight-number">2000</span> } } } )</td></tr></tbody></table></code></pre>
      <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
       <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
        <div class="leafygreen-ui-xhlipt">
         <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
          <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
          </path>
         </svg>
        </div>
       </button>
      </div>
     </div>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    The operation returns a document with the
    <strong>
     previous
    </strong>
    values for the
settings.
   </p>
   <p class="leafygreen-ui-1kp3ins">
    To view the current profiling level, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.getProfilingStatus/#mongodb-method-db.getProfilingStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.getProfilingStatus()
     </code>
     .
    </a>
   </p>
  </section>
  <section>
   <h3 class="contains-headerlink leafygreen-ui-15ajumo" weight="medium">
    Unset a Filter
    <a class="headerlink leafygreen-ui-1kepx47" href="#unset-a-filter" title="Permalink to this heading">
     <svg aria-label="Link Icon" class="leafygreen-ui-a30zj9" fill="none" height="12" role="img" viewbox="0 0 16 16" width="12" xmlns="http://www.w3.org/2000/svg">
      <path d="M6.039 9.953a3.596 3.596 0 0 1-.327-.38l1.45-1.445a1.553 1.553 0 0 0 2.496.423l2.885-2.87a1.57 1.57 0 0 0 .01-2.213 1.553 1.553 0 0 0-2.203-.01l-.379.377A.995.995 0 0 1 8.56 3.83a1.005 1.005 0 0 1 .006-1.418l.38-.377a3.542 3.542 0 0 1 5.024.023 3.58 3.58 0 0 1-.022 5.047l-2.884 2.871a3.542 3.542 0 0 1-5.025-.022Z" fill="currentColor">
      </path>
      <path d="M9.961 6.047c.12.12.228.248.327.38l-1.45 1.445a1.553 1.553 0 0 0-2.496-.423l-2.885 2.87a1.57 1.57 0 0 0-.01 2.213 1.553 1.553 0 0 0 2.203.01l.379-.377a.995.995 0 0 1 1.411.006 1.005 1.005 0 0 1-.006 1.418l-.38.377a3.542 3.542 0 0 1-5.024-.023 3.58 3.58 0 0 1 .022-5.047l2.884-2.871a3.542 3.542 0 0 1 5.025.022Z" fill="currentColor">
      </path>
     </svg>
     <div class="css-1btu0w3 evvkmar0" id="unset-a-filter">
     </div>
    </a>
   </h3>
   <p class="leafygreen-ui-1kp3ins">
    To clear a profile filter, run
    <code class="leafygreen-ui-1l06pbn">
     db.setProfilingLevel()
    </code>
    with the
    <code class="leafygreen-ui-1l06pbn">
     filter: "unset"
    </code>
    option.
   </p>
   <script class="structured_data" type="application/ld+json">
    {"@context":"https://schema.org","@type":"SoftwareSourceCode","codeSampleType":"code snippet","text":"db.setProfilingLevel( 1, { filter: \"unset\" } )","programmingLanguage":"JavaScript"}
   </script>
   <div class="css-16lmvu9">
    <div class="leafygreen-ui-196mwvg">
     <div class="leafygreen-ui-yzcs8i">
      <pre class="leafygreen-ui-1q4bxgx" tabindex="-1"><code class="lg-highlight-hljs-light javascript leafygreen-ui-9ybzas"><table class="leafygreen-ui-1tr4g10"><tbody><tr class=""><td class="leafygreen-ui-7razhx">db.<span class="lg-highlight-title lg-highlight-function">setProfilingLevel</span>( <span class="lg-highlight-number">1</span>, <!-- -->{ <span class="lg-highlight-attr">filter</span>: <span class="lg-highlight-string">"unset"</span> } )</td></tr></tbody></table></code></pre>
      <div class="leafygreen-ui-1bqcprk" data-testid="leafygreen-code-panel">
       <button aria-disabled="false" aria-label="Copy" class="leafygreen-ui-1c6zwke" data-testid="code_copy-button" tabindex="0">
        <div class="leafygreen-ui-xhlipt">
         <svg aria-label="Copy Icon" class="leafygreen-ui-1st74h4" height="16" role="img" viewbox="0 0 16 16" width="16">
          <path clip-rule="evenodd" d="M1 5.71428V10.2857C1 11.2325 1.76751 12 2.71429 12H5.75V7.10957C5.75 6.54414 5.97724 6.00244 6.38065 5.60623L8.67403 3.35381C8.77447 3.25516 8.88376 3.16757 9 3.09182V2.71429C9 1.76751 8.23249 1 7.28571 1H5.8V4.42857C5.8 5.13865 5.22437 5.71428 4.51429 5.71428H1ZM9 4.78571L7.25654 6.49804C7.24689 6.50752 7.23749 6.5172 7.22834 6.52708C7.22208 6.53383 7.21594 6.54068 7.20991 6.54762C7.07504 6.70295 7 6.90234 7 7.10957V7.79762H9H10.0095C10.4829 7.79762 10.8667 7.41386 10.8667 6.94047V4H10.1505C9.92587 4 9.7102 4.0882 9.54992 4.24562L9 4.78571ZM4.86667 1H4.15053C3.92587 1 3.7102 1.0882 3.54992 1.24562L1.25654 3.49804C1.09244 3.65921 1 3.87957 1 4.10957V4.79762H4.00952C4.48291 4.79762 4.86667 4.41386 4.86667 3.94047V1ZM7 12V8.71428H9H10.5143C11.2244 8.71428 11.8 8.13865 11.8 7.42857V4H13.2857C14.2325 4 15 4.76751 15 5.71429V13.2857C15 14.2325 14.2325 15 13.2857 15H8.71429C7.76751 15 7 14.2325 7 13.2857V12Z" fill="currentColor" fill-rule="evenodd">
          </path>
         </svg>
        </div>
       </button>
      </div>
     </div>
    </div>
   </div>
   <p class="leafygreen-ui-1kp3ins">
    The operation returns a document with the
    <strong>
     previous
    </strong>
    values for the
settings.
   </p>
   <p class="leafygreen-ui-1kp3ins">
    To view the current profiling level, see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.getProfilingStatus/#mongodb-method-db.getProfilingStatus">
     <code class="leafygreen-ui-1l06pbn">
      db.getProfilingStatus()
     </code>
     .
    </a>
   </p>
  </section>
 </section>
</section>
