skip to content
Alvin Lucillo

Dropping indexes on the secondary replica

/ 1 min read

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