In the Starting multiple instances as part of a replica set recipe in Chapter 1, Installing and Starting the MongoDB Server, we saw how to set up a simple replica set and what the purpose of a replica set is. We also have a good deal of explanation in Appendix, Concepts for Reference, on what write concern is and why it is used. What we saw about write concerns is that they offer a minimum level guarantee for a certain write operation. However, with the concept of tags and write concerns, we can define a variety of rules and conditions that must be satisfied before a write operation is deemed successful and a response is sent to the user.
Consider some common use cases:
An application wants a write operation to be propagated to at least one server in each of its data centers. This ensures that, in the event of a data center shutdown, other data centers will have the data that was written by the application.
If there aren't multiple data centers, at least one member...