[SERVER-15754] Allow createIndexes to take "key" field as an array Created: 21/Oct/14  Updated: 06/Dec/22  Resolved: 26/Feb/16

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-21888 Provide operation to determine if an ... Closed
is related to SERVER-15753 Compound index is reordered automatic... Closed
is related to MONGOSH-1037 Numeric field are sorted to the front... Closed
is related to SERVER-1627 add createIndexes command Closed
Assigned Teams:
Query
Participants:

 Description   

Allowing the key field to be an array will remove the ordering issues in many languages, and the shell.

Example:

db.a.ensureIndex([{field1:1}, {field2:1}])
db.a.runCommand("createIndexes", {indexes:[{ns:..., key:[{field1:1}, {field2:1}]}]})



 Comments   
Comment by Scott Hernandez (Inactive) [ 26/Feb/16 ]

This could be done at the interface (command/insert) level and not change the storage or internals.

Comment by David Storch [ 26/Feb/16 ]

There are many places in the query system where we use a BSONObj to represent an index key pattern or a sort order. It seems unlikely that we would invest in changing all of these to use a BSON array. Drivers already must be able to serialize sort specifications and index key patterns in a well defined order before sending them to the server. Closing as Won't Fix.

Generated at Thu Feb 08 03:38:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.