I am using Spring Data MongoDB latest version 1.1.1RELEASE and wondering if it possible to add read preference on collection level. Something that possible with plain MongoDB driver. I want all my reads for particular collection go to the slaves to distrubute read operations. Is that possible?
From mongo driver documentation:
Continuing with our sample application, we decide that we want to send our read requests to the nearest node to reduce request latency. The Java drivers read preference API gives a couple of ways of doing this, the easiest is to simply use the nearest mode.
DBObject query = new BasicDBObject("name", "simple doc")
DBObject result =
coll.findOne(query, null, ReadPreference.nearest());
"
Thanks
From mongo driver documentation:
Continuing with our sample application, we decide that we want to send our read requests to the nearest node to reduce request latency. The Java drivers read preference API gives a couple of ways of doing this, the easiest is to simply use the nearest mode.
DBObject query = new BasicDBObject("name", "simple doc")
DBObject result =
coll.findOne(query, null, ReadPreference.nearest());
"
Thanks