] 

} 

} 

You could add tag sets to the members of this replica set with the following command sequence in the mongo shell: 

conf = rs.conf() conf.members[0].tags = { "dc": "east", "use": "production" } conf.members[1].tags = { "dc": "east", "use": "reporting" } conf.members[2].tags = { "use": "production" } rs.reconfig(conf) 

After this operation the output of rs.conf() would resemble the following: 

{ "_id" : "rs0", "version" : 2, "members" : [ { "_id" : 0, "host" : "mongodb0.example.net:27017", "tags" : { "dc": "east", "use": "production" } }, { "_id" : 1, "host" : "mongodb1.example.net:27017", "tags" : { "dc": "east", "use": "reporting" } }, { "_id" : 2, "host" : "mongodb2.example.net:27017", "tags" : { "use": "production" } } ] } 

Important: In tag sets, all tag values must be strings. 

## Custom Multi-Datacenter Write Concerns 

Given a five member replica set with members in two data centers: 

1. a facility VA tagged dc.va 

2. a facility GTO tagged dc.gto 

Create a custom write concern to require confirmation from two data centers using replica set tags, using the following sequence of operations in the mongo shell: 

1. Create a replica set configuration JavaScript object conf : 

