unordered batch / ordered batch contribution

7 views
Skip to first unread message

Sebastian Hennebrueder

unread,
Oct 29, 2014, 4:17:57 AM10/29/14
to congomo...@googlegroups.com
Hi,

I needed the batch processing and started to implement is. It is more or less done. I saw the discussion about moving the project. Is a patch welcome at this stage?

This is how the API looks like:


Best Regards

Sebastian Hennebrueder

Sebastian Hennebrueder

unread,
Oct 30, 2014, 1:39:54 PM10/30/14
to congomo...@googlegroups.com
To explain what it does solve:


I implemented the complete API behind:
// 1. Ordered bulk operation
BulkWriteOperation builder = coll.initializeOrderedBulkOperation();
builder.insert(new BasicDBObject("_id", 1));
builder.insert(new BasicDBObject("_id", 2));
builder.insert(new BasicDBObject("_id", 3));

builder.find(new BasicDBObject("_id", 1)).updateOne(new BasicDBObject("$set", new BasicDBObject("x", 2)));
builder.find(new BasicDBObject("_id", 2)).removeOne();
builder.find(new BasicDBObject("_id", 3)).replaceOne(new BasicDBObject("_id", 3).append("x", 4));

BulkWriteResult result = builder.execute();

// 2. Unordered bulk operation - no guarantee of order of operation
builder = coll.initializeUnorderedBulkOperation();
builder.find(new BasicDBObject("_id", 1)).removeOne();
builder.find(new BasicDBObject("_id", 2)).removeOne();

result = builder.execute();
Best Regards

Sebastian

Sebastian Hennebrueder

unread,
Oct 30, 2014, 5:52:18 PM10/30/14
to congomo...@googlegroups.com
I have pushed a version to discuss here:


Please be aware, that the require statements and the use of fixtures in the test is not compatible with Clojure 1.3

I can fix this if needed

Best Regards / Viele Grüße

Sebastian
Reply all
Reply to author
Forward
0 new messages