In addition, your syntax is wrong. You are missing braces between members.
[ Edited to illustrate my comment above posted from my tablet ]
As you have seen:
mongo > rsconf={_id:"cbre",members:[{_id:0,host:"localhost:27017",_id:1,host:"10.71.101.187:27017",_id:2,host:"10.71.136.191:27017"}]}
gives the following value as you posted
mongo > rsconf
{
"_id" : "cbre",
"members" : [
{
"_id" : 2,
"host" : "10.71.136.191:27017"
}
]
}
So you only have 1 object in the array members. And since you cannot have 2 fields with the same key in a single document you end up with a document that contains the value of the last occurrence of a key. What you really wanted, (with the correct bracing) is:
mongo > rsconf={_id:"cbre",members:[{_id:0,host:"localhost:27017"},{_id:1,host:"10.71.101.187:27017"},{_id:2,host:"10.71.136.191:27017"}]}
{
"_id" : "cbre",
"members" : [
{
"_id" : 0,
"host" : "localhost:27017"
},
{
"_id" : 1,
"host" : "10.71.101.187:27017"
},
{
"_id" : 2,
"host" : "10.71.136.191:27017"
}
]
}
But the above will still be wrong despite having the correct syntax because