# MongoServerError：无法删除系统集合上的索引

- **ID:** `mongodb/cannot-drop-index-on-system-collection`
- **领域:** mongodb
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 72%

## 根因

尝试删除系统集合（如 system.views、system.profile）上的索引，但 MongoDB 内部保护机制禁止此类操作。

## 解决方案

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.
   ```
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.
   ```

## 无效尝试

- **** — 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% 失败率)
- **** — 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% 失败率)
