I am trying to use deletemany in mongodb version 2.6.10? However it gives me error.
Here is my query;
> db.person.deleteMany( {gallery : {$ne:"test"} } );
2017-08-08T13:50:42.580+0300 TypeError: Property 'deleteMany' of object testdb.person is not a function
How I can delete content with where clause?
This works for me
db.person.remove( {gallery : {$ne:"test"} } );
To delete some records we can use:
db.person.remove( {gallery : {$ne:"test"} } );
To delete all records from a collection:
db.person.remove({});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With