<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 刪除 MongoDB 中的集合 > 原文: [https://beginnersbook.com/2017/09/mongodb-drop-collection/](https://beginnersbook.com/2017/09/mongodb-drop-collection/) 在上一個教程中,我們學習了[如何在 MongoDB](https://beginnersbook.com/2017/09/mongodb-create-collection/) 中創建集合。在本指南中,我們將了解如何在 MongoDB 中刪除集合。 要刪除集合,首先連接到要刪除集合的數據庫,然后鍵入以下命令以刪除集合: ```js db.collection_name.drop() ``` > 注意:刪除集合后,所有文檔以及與它們關聯的索引也將被刪除。為了保留索引,我們使用`remove()`函數,該函數僅刪除集合中的文檔,但不刪除集合本身及其上創建的索引。我們將在后面的教程中學習索引和`remove()`函數。 ## MongoDB 刪除集合示例 例如,我想在我的數據庫`beginnersbook.com`中刪除集合名稱`teachers`。為此,我將按給定的順序編寫以下命令。 ```js > use beginnersbookdb switched to db beginnersbookdb > show collections beginnersbook students teachers > db.teachers.drop() true > show collections beginnersbook students ``` 正如您所看到的,命令`db.teachers.drop()`返回`true`,這意味著該集合已成功刪除。我們在刪除后使用`show collections`命令驗證了同樣的事情,如上所示。 ![MongoDB drop collection](https://img.kancloud.cn/9e/82/9e82a08f84385bb8fc234e13712cf83d_452x224.jpg)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看