For AI agents: a documentation index is available at https://www.mongodb.com/es/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

MongoDB\DeleteResult::getDeletedCount()

MongoDB\DeleteResult::getDeletedCount()

Return the number of documents that were deleted.

function getDeletedCount(): integer

This method should only be called if the write was acknowledged.

The number of documents that were deleted.

MongoDB\Exception\BadMethodCallException if this method is called and the write operation used an unacknowledged write concern.