Mongo-hadoop-core and mongo-hadoop-pig add support for "upserting" as well ensuring indexes #44

Merged
merged 4 commits into from Apr 24, 2012

Conversation

Projects
None yet
4 participants
Contributor

rfliam commented Apr 17, 2012

This patch adds a backwards compatible ability to "upsert" records into mongo as well as ensuring indexes.

/**
 * Takes a list of arguments of two types: 
 * <ul>
 * <li>A single set of keys to base updating on in the format:<br />
 * 'update [time, user]' or 'multi [timer, user] for multi updates</li>
 * 
 * <li>Multiple indexes to ensure in the format:<br />
 * '{time: 1, user: 1},{unique: true}'<br />
 * (The syntax is exactly like db.col.ensureIndex())</li>
 * </ul>
 * Example:<br />
 * STORE Result INTO '$db' USING com.mongodb.hadoop.pig.MongoStorage('update [time, servername, hostname]', '{time : 1, servername : 1, hostname : 1}, {unique:true, dropDups: true}').
 * @param args
 * @throws ParseException
 */

bwmcadams pushed a commit that referenced this pull request Apr 24, 2012

Brendan W. McAdams
Merge pull request #44 from rfliam/master
Mongo-hadoop-core and mongo-hadoop-pig add support for "upserting" as well ensuring indexes

@bwmcadams bwmcadams merged commit 2186ef3 into mongodb:master Apr 24, 2012

Contributor

rjurney commented May 17, 2012

This patch broke my MongoDB. I fix.

If the 'update key' string is not provided, would this line not cause NPE?

Contributor

rfliam replied Jun 3, 2012

Yes it would, will fork and fix later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment