Delete Documents删除文档¶
Deleting documents is not permitted in MongoDB Compass Readonly Edition.MongoDB Compass只读版不允许删除文档。
Select the appropriate tab based on whether you are viewing your documents in List, JSON, or Table view:根据您是在列表、JSON还是在表视图中查看文档,选择适当的选项卡:
To delete a document, hover over the document and click the icon.要删除文档,请将鼠标悬停在文档上,然后单击图标。
After you click the delete button, the document is flagged for deletion. 单击“删除”按钮后,文档将被标记为删除。Compass asks for confirmation that you want to remove the document:Compass要求确认您要删除文档:
JSON View is available starting in Compass 1.20.JSON视图从Compass 1.20开始提供。
To delete a document, hover over the document and click the icon.要删除文档,请将鼠标悬停在文档上,然后单击图标。
After you click the delete button, the document is flagged for deletion. 单击“删除”按钮后,文档将被标记为删除。Compass asks for confirmation that you want to remove the document:Compass要求确认您要删除文档:
To delete a document, hover over the document and click the icon.要删除文档,请将鼠标悬停在文档上,然后单击图标。
After you click the delete button, the document is flagged for deletion. 单击“删除”按钮后,文档将被标记为删除。Compass asks for confirmation that you want to remove the document:Compass要求确认您要删除文档:
Once you confirm, Compass deletes the document from the collection.确认后,Compass将从集合中删除文档。
Delete Multiple Documents删除多个文档¶
You cannot delete multiple documents at once from the Compass UI. 不能从Compass UI一次删除多个文档。As an alternative, you can use the db.collection.deleteMany() method in the embedded MongoDB Shell to delete multiple documents in a single operation.或者,您可以使用嵌入式MongoDB Shell中的db.collection.deleteMany()
方法在一次操作中删除多个文档。