forked from mongodb/mongo-hadoop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support document replacement (HADOOP-263).
- Loading branch information
Luke Lovett
committed
May 4, 2016
1 parent
e99542e
commit 6a662c5
Showing
7 changed files
with
106 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
documents = | ||
LOAD 'mongodb://localhost:27017/mongo_hadoop.replace_test' | ||
USING com.mongodb.hadoop.pig.MongoLoader('id:chararray,i:int', 'id'); | ||
|
||
increment_number = | ||
FOREACH documents | ||
GENERATE com.mongodb.hadoop.pig.udf.ToObjectId(id) AS id, | ||
i + 1 AS i; | ||
|
||
STORE increment_number | ||
INTO 'mongodb://localhost:27017/mongo_hadoop.replace_test' | ||
USING com.mongodb.hadoop.pig.MongoUpdateStorage( | ||
'{_id:"\$id"}', -- query | ||
'{i:"\$i"}', -- replacement | ||
'id:bytearray,i:int', -- schema | ||
'', -- toIgnore (none) | ||
'{replace:true}' -- update options | ||
); |