We are using Mongo DB for our Java Java EE based application.
We are using one primary and two secondary as part of cluster of Mongo DB
The Mongo DB is continuously read / Updated / Write as part of our architecture.
Due to this we are getting Dirty Reads ( zero values ) When we do a fetch operation from Mongo DB.
TO solve this, I am trying to configure it in such a way that the read operation always fetches from primary itself and writes / updates can go to primary / secondary.
Please let me know if this is possible (always read from primary and use any thing primary/secondary for write/update)
And will it have any negative impact with such a design?
Due to mongoDB uses staged writing in inserts, you can have lag in write operations even in a single node.
http://docs.mongodb.org/manual/reference/glossary/#term-journal
Use write concern to avoid problems (with dirty data): http://api.mongodb.org/java/2.6/com/mongodb/WriteConcern.html
You can read more about write operations:
http://docs.mongodb.org/manual/core/write-operations/
Which states that using writes without error check is not recommended for production.