# MongoServerError: can't drop index on system collection

- **ID:** `mongodb/cannot-drop-index-on-system-collection`
- **Domain:** mongodb
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 72%

## Root Cause

Attempted to drop an index on a system collection (e.g., system.views, system.profile) which is restricted by MongoDB's internal protections.

## Workarounds

1. **Use db.adminCommand({dropIndexes: 'admin.system.views', index: 'my_index_name'}) as a superuser, but only if absolutely necessary and after backing up the collection.** (70% success)
   ```
   Use db.adminCommand({dropIndexes: 'admin.system.views', index: 'my_index_name'}) as a superuser, but only if absolutely necessary and after backing up the collection.
   ```
2. **Disable the system collection's read-only flag temporarily by restarting mongod with --setParameter 'systemCollectionsReadOnly=false' (MongoDB 6.0+), then drop the index, then re-enable.** (75% success)
   ```
   Disable the system collection's read-only flag temporarily by restarting mongod with --setParameter 'systemCollectionsReadOnly=false' (MongoDB 6.0+), then drop the index, then re-enable.
   ```

## Dead Ends

- **** — Using db.collection.dropIndex() on a system collection with force:true ignores the error but corrupts internal metadata, leading to server crash or data loss. (95% fail)
- **** — Changing the collection name to a non-system prefix (e.g., 'my_views') and re-creating indexes doesn't fix the original system collection; the error persists. (80% fail)
