MarkLogic version : 9.0-6.2
All documents in our DB are JSONs and we use Javascript to manipulate data. I am trying to create a pipeline that identifies whenever a Phone Number in the JSON document is updated (using a condition module) and then runs an action module. So far, I got the below code.
{
"pipeline-name": "CPF async Test",
"pipeline-description": "CPF Test",
"success-action": {
"module": "/MarkLogic/cpf/actions/success-action.xqy"
},
"failure-action": {
"module": "/marklogic/cpf/actions/failure-action.xqy"
},
"status-transition": [
{
"annotation": "",
"status": "updated",
"on-success": "http://marklogic.com/states/done",
"on-failure": "http://marklogic.com/states/error",
"execute": [
{
"condition": {
"module": ???
},
"action": {
"module": "sleepTest.sjs"
}
}
]
}
]
}
When I tried to load this JSON as pipeline using admin console (with filter as filename.json), I am getting a message "Invalid input: No readable XML files found:"
Should a pipeline be always XML?
I am able to write (in JavaScript) and execute the action module successfully. I tested it within an XML pipeline. Can I write a condition module in JavaScript too?
I am not sure if there is a built-in condition module provided by MarkLogic that identifies the changes to a property (by passing the property as parameter to the condition module). If yes, could you please point to the documentation? If I have to create a custom condition module, how can I pass old and new phone numbers to the module? How would the condition module look like, preferably in JavaScript?
Most of the documentation I found on CPF is XML/XQuery. Any pointers to JSON/JavaScript CPF documentation is appreciated.
Thanks in advance!