-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small example on how to use "script filters"
- Loading branch information
1 parent
c33e19b
commit 106de70
Showing
5 changed files
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
curl -XPUT "http://localhost:9200/_river/mongodb42/_meta" -d @mongodb-river-script-filters.json |
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,8 @@ | ||
%MONGO_HOME%\bin\mongo < test-issue-42-import-document.js | ||
pause | ||
curl -XGET localhost:9200/mydb-42/_search?q=firstName:John42 | ||
pause | ||
%MONGO_HOME%\bin\mongo < test-issue-42-update-document.js | ||
pause | ||
curl -XGET localhost:9200/mydb-42/_search?q=firstName:John42 | ||
pause |
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,12 @@ | ||
{ | ||
"type": "mongodb", | ||
"mongodb": { | ||
"db": "mydb", | ||
"collection": "mycollec", | ||
"script": "if( ctx.document.state == 'CLOSED' ) { ctx.deleted = true; }" | ||
}, | ||
"index": { | ||
"name": "mydb-42", | ||
"type": "mycollec-42" | ||
} | ||
} |
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,10 @@ | ||
use mydb | ||
var o = | ||
{ | ||
"firstName": "John42", | ||
"lastName": "Doe42", | ||
"age": 34, | ||
"state": "OPENED" | ||
} | ||
|
||
db.mycollec.save(o) |
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,4 @@ | ||
use mydb | ||
var o = db.mycollec.findOne({"firstName": "John42", "lastName": "Doe42"}) | ||
o.state = 'CLOSED'; | ||
db.mycollec.save(o) |