You can’t drop an index on a secondary replica directly. This is because dropping an index is considered a write operation, and you can only perform read operations on a replica.
db.events.dropIndex('name_1_type_1')
MongoServerError[NotWritablePrimary]: not primary