What happens when mongodb deleteMany{()} is executed whitout query / empty query?

309 Views Asked by At

i wanted to ask what happens when collection.deleteMany{()} is executed in java without any query or empty string. Will it fail to execute (as in nothing is deleted) or will it drop the whole database?

1

There are 1 best solutions below

2
mohammad Naimi On

in deleteMany() when you execute without query it returns error if you want to delete whole collection you could use deleteMany({})