When dropping an index by name from a specific collection, the operation incorrectly deletes the index from all collections in the database that have an index with the same name, instead of only affecting the target collection.
This can be reproduced by creating identical indexes on two different collections (e.g., collectionOne and collectionTwo both indexing myField). By default, both get the index name myField_1.
If you run collectionOne.dropIndex("myField_1"), the index is incorrectly deleted from collectionTwo as well. The expected behavior is that collectionTwo remains untouched.
The issue is in AbstractMongoDatabase.dropIndexes(). When handling an index name (String), the delete query sent to system.indexes filters only by name, completely omitting the namespace (ns). Consequently, it matches all indexes with that name globally.
A PR to fix the issue will follow shortly.