mongodb/mongo-hadoop — pull request #44 by rfliam (2012-04-17 18:47:10+00:00)
Title: Mongo-hadoop-core and mongo-hadoop-pig add support for "upserting" as well ensuring indexes

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:
*

*
A single set of keys to base updating on in the format:

* 'update [time, user]' or 'multi [timer, user] for multi updates

*
*
Multiple indexes to ensure in the format:

* '{time: 1, user: 1},{unique: true}'

* (The syntax is exactly like db.col.ensureIndex())

*

* Example:

* 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
*/