I have this config:
{
"adminInterface": ":4985",
"interface": ":4984",
"log":["Events"],
"databases": {
"db": {
"server": "some_url:8091",
"bucket": "default",
"username": "Administrator",
"password": "Password",
"enable_shared_bucket_access": true,
"import_docs": true,
"num_index_replicas": 0,
"use_views": true,
"users": {
"GUEST": { "disabled": false, "admin_channels": ["*"] },
"sync_gateway": {"password": "pass1234"}
},
"event_handlers":{
"document_changed":[
{
"handler":"webhook",
"url":"some_endpoint",
"filter":`function(doc){
if(doc.docType=="TFO"){
console.log("WEBHOOK TRIGGERED! docType: "+doc.docType+doc.id);
return true;
}
else return false
}`
}
]
}
}
}
}
When I add document via Admin rest API, the webhook is being triggered too many times.
PUT server_url:4985/db/TFO::011
{
“docType”: “TFO”,
“id”: “TFO::011”
}