[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:
Related
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:
http://docs.mongodb.org/manual/administration/replica-sets/

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. If/when we get to the point of automating modifications to the replica set, it'll be time to try to wrap it into a smarter management system that'll make sure the changes are beng applied to the correct node..

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,
sam

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:

cfg.members[_id=1] = bla

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: DOCS-516 clarification about replica set configuration document
Branch: master
https://github.com/mongodb/docs/commit/79b475aaa69fb9b38a69ac74fe7f1b32d204c5db

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