Database.Changed on Document Updates

Hi, I’m trying to get SG hooked up in one of my apps and for some reason the changed event is only firing when I make changes from the SG Port, 4985. If I edit the documents from the Server directly, 8091, the document gets updated on the SG as well, but there is no event fired.

Here is my config file:

{
“log”: [“HTTP+”],
“CORS”: {
“origin”:[“http://servername:4985”],
“loginOrigin”:[“http://servername:4985”],
“headers”:[“Content-Type”],
“maxAge”: 1728000
},
“databases”: {
“db”: {
“server”: “http://localhost:8091”,
“bucket”: “Bucket”,
“enable_shared_bucket_access”:true,
“import_docs”: “continuous”,
“username”: “admin”,
“password”: “admin”,
“users”: {“GUEST”: {“disabled”: false, “admin_channels”: ["*"]}},
“sync”: function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); } }
}
}
}

Is there a step I skipped?

Thanks,
Shahid

The CORS configuration does not seem correct. This is a useful to interact directly with Sync Gateway from web applications. Please remove that and retry.

Do you mean that your mobile clients don’t see the DB change ? Can you elaborate what you mean by “no event fired”. I would check the sync function and see if it is in fact pushing the doc to the right channel. And if so, check the client side replicator to see what kind of channel filters (if any) are setup on pull replicator.
For basic case, remove the sync function completely and see if the change makes its way to the client. Then work your way from there and update the sync function to do data routing…