Computer scienceFundamentalsSQL and DatabasesDBMSMongoDBOperations and operators

Bulkwrite operations in MongoDB

Good boys

Report a typo

We have a collection called dogs where these records are stored:

[
  {_id: 1, name: "Mike", breed: "Labrador"},
  {_id: 2, name: "Bella", breed: "Beagle"},
  {_id: 3, name: "Max", breed: "Labrador"},
  {_id: 4, name: "Cooper", breed: "Bulldog"}
]

Then we executed this command:

db.dogs.bulkWrite([
   { deleteOne: {"filter": {"breed": "Labrador"}} },
   { deleteOne: {"filter": {"breed": "Bulldog"}} }
])

How many records are left in the collection?

Enter a number
___

Create a free account to access the full topic