Delete Multiple Documents
You can perform bulk delete operations on multiple documents in Compass by using the Delete Documents modal. This helps you visualize deletes before applying them.
About this Task
Deleting documents is a permanent action and cannot not be undone. Validate documents in the Preview of the Delete Documents modal before confirming the delete operation.
Before you Begin
The Delete Documents modal is available starting
in Compass version 1.42.0
. For instructions on updating or installing
the latest Compass version, see Download and Install Compass.
Steps
Open the Delete Documents modal
On the Documents tab, click the Delete button to display the Delete Documents modal. The following table summarizes the UI of the modal:
UI Element | Description |
---|---|
Query | Any filter criteria specified on the Query Bar applies to the Delete Documents modal. To update the Query, exit the Delete Documents modal and modify the query in the Query Bar. |
Export | Opens the Export Delete Query To Language modal, where you can convert the query to a supported driver language. |
Preview | A preview of the documents that will be deleted. |
(Optional) Export the Delete
You can export the Delete query to a supported driver language using the Export button on the Delete Documents modal.
On the Delete Documents modal, click Export. The Export Delete Query To Language modal displays with the delete syntax populated under My Delete Query.
Select a programming language from the drop-down under Exported Delete Query. You can convert the command to C#, Go, Java, Node, PHP, Python, Ruby, or Rust. The field below displays the converted syntax.
(Optional) Click the Include Import Statements checkbox to include the required import statements for the selected programming language.
Click the icon to copy the converted syntax.
Click Close.
Example
The following example deletes two documents from
the movies
collection in the sample_mflix dataset.
In the Query Bar, enter a filter for movies
with a year
of 1919
.
{ 'year' : 1919 }
Click the Delete button, the Delete Documents modal displays.
The Preview pane shows the documents included in the delete operation.
Click Delete Documents. A confirmation modal displays.
Click the red Delete Documents button to confirm the operation.