Docs Menu

Docs HomeDevelop ApplicationsMongoDB DriversC#/.NET

Delete Many Documents

On this page

  • Example
  • Expected Result
  • Additional Information
  • API Documentation

You can delete more than one document using the DeleteMany() synchronous method or the DeleteManyAsync() asynchronous method on a collection object.

The following code deletes all documents in the restaurants collection whose borough field value equals the word "Brooklyn".

Select the Asynchronous or Synchronous tab to see the corresponding code.

Running either of the preceding full examples prints the following results:

Deleting documents...
Deleted documents: 6086
Resetting sample data...done.

To learn more about deleting documents, see the Delete Documents guide.

To learn more about using builders, see Operations with Builders.

  • DeleteMany()

  • DeleteManyAsync()

← Delete a Document