-
Dec 13th, 2012, 04:07 PM
#1
Configuring read preferences for MongoDB in Spring Data on collection level
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 driver’s 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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules