[DOCS-516] Clarify members[n] array references on replica set configuration Created: 12/Sep/12 Updated: 30/Oct/23 Resolved: 29/Sep/12 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | manual |
| Affects Version/s: | None |
| Fix Version/s: | Server_Docs_20231030 |
| Type: | Task | Priority: | Minor - P4 |
| Reporter: | Stennie Steneker (Inactive) | Assignee: | Sam Kleinman (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Participants: | |||||
| Days since reply: | 11 years, 19 weeks ago | ||||
| Description |
|
The documentation of replica sets is not explicit enough that cfg.members is a 0-indexed array rather than an associative array: For example, cfg.members[1] is referring to the second member of the array, not the member with _id: 1. Initially the _ids will match, but this won't be the case if members are deleted from a replica set. |
| Comments |
| Comment by Nate Carlson [ 10/Oct/12 ] | |
|
Thanks for the quick reply! We'll just add it to our notes and make sure that we triple-check things in the future. Appreciate it! | |
| Comment by Sam Kleinman (Inactive) [ 10/Oct/12 ] | |
|
The short answer is that there isn't a good way around this without fundamentally changing the replica set configuration object itself. The JavaScript idiom doesn't provide for these kinds of references, but you might ask in the user group <https://groups.google.com/forum/#!forum/mongodb-user>, or see if you can cook something up with one of the drivers. Sorry about this! Cheers, | |
| Comment by Nate Carlson [ 10/Oct/12 ] | |
|
Is there a way (or a possibility for a way) to specify by the _id verus position in the array? IE - something like:
This tripped us up for a bit. Thanks! | |
| Comment by auto [ 29/Sep/12 ] | |
|
Author: {u'date': u'2012-09-29T06:37:25-07:00', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}Message: |