The current configuration of MongoDb is:
Scenario:
The question is, since the application is set to read from the nearest instance, and let's say the nearest instance is the other secondary (C), if a read request comes through while the write operation is still in progress on the other 2 instances, would the read be allowed or blocked. If it will be allowed, how can I prevent it?
if a read request comes through while the write operation is still in progress on the other 2 instances, would the read be allowed or blocked
Well, you sort of figured it out yourself. You can read (a stale data) from 'C' if it's in the nearest group
how can I prevent it?
Read preference can be applied globally by your driver, database level, collection level or operation level (same can be applied more or less for write concern). If for that certain operation you can't suffer stale data, you can override your read preference for that specific query to primary
after you had issued the insert (note that in that scenario the insert operation can be set with a write concern of {w:1}