Hi.
We should specify shard key condition to use db.collection.remove() operation on sharded cluster.
But not for db.collection.deleteMany() operation.
Delete Behavior
Indexes
Delete operations do not drop indexes, even if deleting all documents from a collection.
Does "drop indexes" of this paragraph mean db.collection.dropIndex() ? or delete() does not remove entry of index which is belong to documents which will be removed ?
I think delete() operation is kind of DML not DDL. I don't understand why manual note something about DDL(drop indexes) in page of DML(delete()).
It's confusing to me.
The remove() method uses the delete command, which uses the default write concern. To specify a different write concern, include the write concern in the options parameter.
According to the manual, Looks like both of remove() and deleteMany() are use same internal command.
Then why does delete[One | Many]() method is introduced in MongoDB 3.2 ?
I am wondering that there's some reason MongoDB make new method (deleteOne, deleteMany) beside of remove().
Regards,
Matt.