MongoCollection collection = mongoDatabase.getCollection("WSAccessThrottle");
BatchedWrite.Builder writes = BatchedWrite.builder();
DocumentBuilder queryBuilder = BuilderFactory.start();
DocumentBuilder updateBuilder = BuilderFactory.start();
for (WSAccessThrottle entry : changedEntries) {
queryBuilder.push("_id").add("endPt", entry.getId().getEndPt())
.add("url", entry.getId().getUrl()); updateBuilder.push("$set").add("lastModfDt",entry.getLastModfDt()).add("expireAt",entry.getExpireAt()).add("numAccess", entry.getNumAccess());
writes.update(queryBuilder.build(), updateBuilder.build(), false, true);
queryBuilder.reset();
updateBuilder.reset();
}
collection.write(writes);
On Saturday, 30 January 2016 18:59:49 UTC+11, Archanaa Panda wrote:
I am currently using Allanbank’s mongoClient particularly for asynchronous updates and batched inserts/updates in our spring web services application while using Spring Data mongodb for simple CRUD scenarios, which is based on the traditional mongodb java driver 2.13.0.
Hi Archanaa,
As far as I’m aware the Allanbank driver does not have any dependencies on the standard MongoDB Java driver so it’s unclear if it implements similar connection management or server discovery and monitoring method. The Allanbank driver author does participate in this forum, but you may want to try asking the question directly in the Github issue queue for Allanbank async driver.
FYI, starting with the MongoDB 3.0 Java driver release there is also an officially supported asynchronous Java driver.
Regards,
Stephen