-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Admin, Index Maintenance
-
None
It seems like it would make sense to have a createIndex command; it would then round out the commands for all index operations (like deleteIndex, reIndex). Conceptually this seems consistent and would remove knowledge about "system.indexes" from within the drivers. Drivers can migrate to this syntax if they see the command available.
This command should take an array of indexes to build in parallel (like compact does). Tools should be changed to use this command so that they are more efficient; then mongorestore can build all indexes at the same time.
Possible format, which will be expanded in the next months:
>db.coll.runCommand("createIndexes", {ensure:true ,indexes: [ {keys:{}, option1:.., option2:...}, {keys:{}, option1:.., option2:...} ]}) { ok:1.0, result: { millis: ###, indexes: [ {status:"built/failed" <, nkeys: ##, millis: ###, nscannedObjects: ###, stats...>} ] }}
The "indexes" field should also take a single doc, instead of an array, for simplicity.
- is depended on by
-
SERVER-12215 createIndex and ensureIndex do not report error with write commands
- Closed
-
CSHARP-889 Support createdIndexes command
- Closed
-
JAVA-1080 Support createIndexes command when available
- Closed
-
DRIVERS-132 Use createIndexes command when available
- Closed
- is duplicated by
-
SERVER-7946 Command to build multiple indexes at the same time
- Closed
- is related to
-
SERVER-2441 ensureIndex records arbitrary direction objects
- Closed
-
SERVER-12542 Add auditing hook to mongos commands which delegate to shards
- Backlog
-
SERVER-12517 Add listIndexes command
- Closed
-
SERVER-13240 CreateIndexes: report per index errors/status
- Closed
- related to
-
SERVER-12747 createIndexes: 'createdCollectionAutomatically' value is incorrect when collection creation fails
- Closed
-
DRIVERS-186 Parallel index creation with createIndexes command
- Closed
-
SERVER-15754 Allow createIndexes to take "key" field as an array
- Closed
-
SERVER-12967 remove createIndexes 'noChangesMade' field as its redundant
- Closed