<section>
 <h1 class="contains-headerlink leafygreen-ui-41fr9s" weight="medium">
  Collection Methods
  <a class="headerlink leafygreen-ui-1kepx47" href="#collection-methods" 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="collection-methods">
   </div>
  </a>
 </h1>
 <div class="leafygreen-ui-15mdk4" role="note">
  <h2 class="leafygreen-ui-6n7b7d">
   Note
  </h2>
  <h3 class="leafygreen-ui-144d5kf">
   <strong>
    mongosh Methods
   </strong>
  </h3>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    The methods listed on this table of contents page are
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh" target="_self">
     <span>
      <code class="leafygreen-ui-1l06pbn">
       mongosh
      </code>
     </span>
    </a>
    methods.  This is
    <em>
     not
    </em>
    the documentation for
    <code class="leafygreen-ui-1l06pbn">
     Node.js
    </code>
    or other programming language specific driver methods.
   </p>
   <p class="leafygreen-ui-1kp3ins">
    In most cases,
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/mongodb-shell/#mongodb-binary-bin.mongosh" target="_self">
     <span>
      <code class="leafygreen-ui-1l06pbn">
       mongosh
      </code>
     </span>
    </a>
    methods work the same way as the
legacy
    <code class="leafygreen-ui-1l06pbn">
     mongo
    </code>
    shell methods. However, some legacy methods
are unavailable in
    <code class="leafygreen-ui-1l06pbn">
     mongosh
    </code>
    .
   </p>
   <p class="leafygreen-ui-1kp3ins">
    For MongoDB API drivers, refer to the language specific
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/drivers/" target="_self">
     <span>
      MongoDB driver
     </span>
    </a>
    documentation.
   </p>
  </div>
 </div>
 <div class="leafygreen-ui-15mdk4" role="note">
  <h2 class="leafygreen-ui-6n7b7d">
   Note
  </h2>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    For details on a specific method, including syntax and examples,
click on the link to the method's reference page.
   </p>
  </div>
 </div>
 <div class="leafygreen-ui-skkc39" tabindex="0">
  <table class="leafygreen-ui-hr8lsv">
   <colgroup>
    <col style="width:30%"/>
    <col style="width:70%"/>
   </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>
        Name
       </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="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.analyzeShardKey/#mongodb-method-db.collection.analyzeShardKey">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.analyzeShardKey()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Calculates metrics for evaluating a shard key.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.aggregate/#mongodb-method-db.collection.aggregate">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.aggregate()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Provides access to the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/core/aggregation-pipeline/#std-label-aggregation-pipeline">
         aggregation pipeline
         <!-- -->
         .
        </a>
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.bulkWrite/#mongodb-method-db.collection.bulkWrite">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.bulkWrite()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Provides bulk write operation functionality.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.configureQueryAnalyzer/#mongodb-method-db.collection.configureQueryAnalyzer">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.configureQueryAnalyzer()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Configures query sampling for a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.count/#mongodb-method-db.collection.count">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.count()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Wraps
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/count/#mongodb-dbcommand-dbcmd.count">
         <code class="leafygreen-ui-1l06pbn">
          count
         </code>
        </a>
        to return a count of the number of documents in a collection or a view.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.countDocuments/#mongodb-method-db.collection.countDocuments">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.countDocuments()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Wraps the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/operator/aggregation/group/#mongodb-pipeline-pipe.-group">
         <code class="leafygreen-ui-1l06pbn">
          $group
         </code>
        </a>
        aggregation stage with a
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/operator/aggregation/sum/#mongodb-group-grp.-sum">
         <code class="leafygreen-ui-1l06pbn">
          $sum
         </code>
        </a>
        expression to return a count of the number of documents in a
collection or a view.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.createIndex/#mongodb-method-db.collection.createIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.createIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Builds an index on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.createIndexes/#mongodb-method-db.collection.createIndexes">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.createIndexes()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Builds one or more indexes on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.dataSize/#mongodb-method-db.collection.dataSize">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.dataSize()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Returns the size of the collection. Wraps the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-data-collStats.size">
         <code class="leafygreen-ui-1l06pbn">
          size
         </code>
        </a>
        field in the output of the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-dbcommand-dbcmd.collStats">
         <code class="leafygreen-ui-1l06pbn">
          collStats
         </code>
         .
        </a>
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.deleteOne/#mongodb-method-db.collection.deleteOne">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.deleteOne()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Deletes a single document in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.deleteMany/#mongodb-method-db.collection.deleteMany">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.deleteMany()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Deletes multiple documents in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.distinct/#mongodb-method-db.collection.distinct">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.distinct()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Returns an array of documents that have distinct values for the specified field.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.drop/#mongodb-method-db.collection.drop">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.drop()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Removes the specified collection from the database.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.dropIndex/#mongodb-method-db.collection.dropIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.dropIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Removes a specified index on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.dropIndexes/#mongodb-method-db.collection.dropIndexes">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.dropIndexes()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Removes all indexes on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.ensureIndex/#mongodb-method-db.collection.ensureIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.ensureIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Removed. Use
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.createIndex/#mongodb-method-db.collection.createIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.createIndex()
         </code>
         .
        </a>
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.estimatedDocumentCount/#mongodb-method-db.collection.estimatedDocumentCount">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.estimatedDocumentCount()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Wraps
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/count/#mongodb-dbcommand-dbcmd.count">
         <code class="leafygreen-ui-1l06pbn">
          count
         </code>
        </a>
        to return an approximate count of the documents in a collection or a view.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.explain/#mongodb-method-db.collection.explain">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.explain()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Returns information on the query execution of various methods.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.find/#mongodb-method-db.collection.find">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.find()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Performs a query on a collection or a view and returns a cursor object.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.findAndModify/#mongodb-method-db.collection.findAndModify">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.findAndModify()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Atomically modifies and returns a single document.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.findOne/#mongodb-method-db.collection.findOne">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.findOne()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Performs a query and returns a single document.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.findOneAndDelete/#mongodb-method-db.collection.findOneAndDelete">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.findOneAndDelete()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Finds a single document and deletes it.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.findOneAndReplace/#mongodb-method-db.collection.findOneAndReplace">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.findOneAndReplace()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Finds a single document and replaces it.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.findOneAndUpdate/#mongodb-method-db.collection.findOneAndUpdate">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.findOneAndUpdate()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Finds a single document and updates it.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.getIndexes/#mongodb-method-db.collection.getIndexes">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.getIndexes()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Returns an array of documents that describe the existing indexes on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.getShardDistribution/#mongodb-method-db.collection.getShardDistribution">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.getShardDistribution()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        For collections in sharded clusters,
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.getShardDistribution/#mongodb-method-db.collection.getShardDistribution">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.getShardDistribution()
         </code>
        </a>
        reports data of
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/glossary/#std-term-chunk">
         chunk
        </a>
        distribution.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.getShardVersion/#mongodb-method-db.collection.getShardVersion">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.getShardVersion()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Internal diagnostic method for sharded cluster.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.hideIndex/#mongodb-method-db.collection.hideIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.hideIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Hides an index from the query planner.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.insertOne/#mongodb-method-db.collection.insertOne">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.insertOne()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Inserts a new document in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.insertMany/#mongodb-method-db.collection.insertMany">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.insertMany()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Inserts several new document in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.isCapped/#mongodb-method-db.collection.isCapped">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.isCapped()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Reports if a collection is a
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/glossary/#std-term-capped-collection">
         capped collection
         <!-- -->
         .
        </a>
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.latencyStats/#mongodb-method-db.collection.latencyStats">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.latencyStats()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Returns latency statistics for a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.mapReduce/#mongodb-method-db.collection.mapReduce">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.mapReduce()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Performs map-reduce style data aggregation.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.reIndex/#mongodb-method-db.collection.reIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.reIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Rebuilds all existing indexes on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.remove/#mongodb-method-db.collection.remove">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.remove()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Deletes documents from a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.renameCollection/#mongodb-method-db.collection.renameCollection">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.renameCollection()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Changes the name of a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.replaceOne/#mongodb-method-db.collection.replaceOne">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.replaceOne()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Replaces a single document in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.stats/#mongodb-method-db.collection.stats">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.stats()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Reports on the state of a collection. Provides a wrapper around the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-dbcommand-dbcmd.collStats">
         <code class="leafygreen-ui-1l06pbn">
          collStats
         </code>
         .
        </a>
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.storageSize/#mongodb-method-db.collection.storageSize">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.storageSize()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Reports the total size used by the collection in bytes. Provides a wrapper around the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-data-collStats.storageSize">
         <code class="leafygreen-ui-1l06pbn">
          storageSize
         </code>
        </a>
        field of the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-dbcommand-dbcmd.collStats">
         <code class="leafygreen-ui-1l06pbn">
          collStats
         </code>
        </a>
        output.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.totalIndexSize/#mongodb-method-db.collection.totalIndexSize">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.totalIndexSize()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Reports the total size used by the indexes on a collection. Provides a wrapper around the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-data-collStats.totalIndexSize">
         <code class="leafygreen-ui-1l06pbn">
          totalIndexSize
         </code>
        </a>
        field of the
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/command/collStats/#mongodb-dbcommand-dbcmd.collStats">
         <code class="leafygreen-ui-1l06pbn">
          collStats
         </code>
        </a>
        output.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.totalSize/#mongodb-method-db.collection.totalSize">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.totalSize()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Reports the total size of a collection, including the size of all documents and all indexes on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.unhideIndex/#mongodb-method-db.collection.unhideIndex">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.unhideIndex()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Unhides an index from the query planner.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.updateOne/#mongodb-method-db.collection.updateOne">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.updateOne()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Modifies a single document in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.updateMany/#mongodb-method-db.collection.updateMany">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.updateMany()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Modifies multiple documents in a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.watch/#mongodb-method-db.collection.watch">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.watch()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Establishes a Change Stream on a collection.
       </div>
      </div>
     </td>
    </tr>
    <tr class="leafygreen-ui-15dvrnp">
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/db.collection.validate/#mongodb-method-db.collection.validate">
         <code class="leafygreen-ui-1l06pbn">
          db.collection.validate()
         </code>
        </a>
       </div>
      </div>
     </td>
     <td class="leafygreen-ui-1drjk7h">
      <div class="leafygreen-ui-1n4j8xf">
       <div>
        Performs diagnostic operations on a collection.
       </div>
      </div>
     </td>
    </tr>
   </tbody>
  </table>
 </div>
 <div class="leafygreen-ui-13vw3ie" role="note">
  <h2 class="leafygreen-ui-1fn4p2b">
   Tip
  </h2>
  <h3 class="leafygreen-ui-144d5kf">
   <strong>
    See also:
   </strong>
  </h3>
  <div class="leafygreen-ui-9mycqc">
   <p class="leafygreen-ui-1kp3ins">
    To manage
    <a class="lg-ui-0001 leafygreen-ui-fgcsv5" href="https://www.mongodb.com/docs/atlas/atlas-search/atlas-search-overview/#fts-indexes" target="_self">
     <span>
      Atlas Search indexes
     </span>
    </a>
    ,
see
    <a class="leafygreen-ui-tqgtui" href="/docs/manual/reference/method/js-atlas-search/#std-label-atlas-search-index-methods">
     Atlas Search Index Methods
     <!-- -->
     .
    </a>
   </p>
  </div>
 </div>
</section>
