[DOCS-5263] createIndexes command and the ns index option Created: 23/Apr/15 Updated: 30/Oct/23 Resolved: 30/Mar/16 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Jeremy Mikola | Assignee: | Steve Renaker (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | indexing | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: | |
| Days since reply: | 7 years, 46 weeks ago |
| Description |
|
The createIndexes command documentation mentions that ns may be specified when creating an index and will be generated by MongoDB if omitted. Since the command is executed with a specific database and collection, I curiously tried to see how different ns values were handled. Testing against 3.0 showed that the command fails with a "namespace mismatch" error message if the ns for any index specifies a different database or collection. I'm not surprised, but the documentation lead me to believe that I could specify other namespaces. Perhaps we should clarify that the ns option, if specified, must correspond to the database and collection of the command. If I had to guess, ns was a relic from documentation of the legacy index creation method (i.e. inserting into system.indexes), which would have allowed different namespaces to be specified (of various collections, albeit in the same database). |
| Comments |
| Comment by Githook User [ 30/Mar/16 ] |
|
Author: {u'username': u'steveren', u'name': u'Steve Renaker', u'email': u'steve.renaker@mongodb.com'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Githook User [ 30/Mar/16 ] |
|
Author: {u'username': u'steveren', u'name': u'Steve Renaker', u'email': u'steve.renaker@mongodb.com'}Message: Signed-off-by: kay <kay.kim@10gen.com> |
| Comment by Steve Renaker (Inactive) [ 29/Mar/16 ] |
|
In that case there's no reason to include it in the 3.2 manual. I'll remove it. |
| Comment by Steve Renaker (Inactive) [ 29/Mar/16 ] |
|
I've verified that all the different index creation commands (createIndexes, createIndex(), ensureIndex()) accept the ns option, but there's no way to enter anything other than what the default would be without generating an error, so there's really no reason for the option to exist. Should we remove it from the docs? |