Hello,
I’m trying to identify when an object has been deleted from the Server implementation of Couchbase with the Ruby on Rails wrapper and having that propagate into the sync-gateway and down into the mobile device via live query.
I’ve found that when I delete the document from the database using the connection.delete(id) methodology that sync-gateway (and subsequently live query) is never pinged, but when I create or modify a document sync-gateway is pinged and the information propagates.
I’m using a fairly stock implementation of live query and you can see my config for the sync-gateway here:
{
“interface”:":4984",
“adminInterface”:":4985",
“log”:[“REST”],
“databases”:{
“sync_gateway”:{
“server”:“http://localhost:8091”,
“bucket”:“sync_staging”,
“import_docs”:true,
“sync”:function(doc) {channel(doc.type);}
,
“importDocs”: “continuous”,
“shadow”: {
“server”: “http://localhost:8091”,
“bucket”: “staging_bucket”
},
“users”: {
“GUEST”: {“disabled”: false, “admin_channels”:[""], “all_channels”:[""]}
}
}
}
}
and the gems I’m using are here:
“couchbase” (https://rubygems.org/gems/couchbase)
“couchbase-model” (https://rubygems.org/gems/couchbase-model)
and the deletion methodology is here:
connection = Couchbase.connect(:bucket => COUCHBASE_BUCKET)
connection.delete(id)
I’ve also tried:
document.delete
but with the same results.
Lastly, my Live Query check is here:
com.couchbase.lite.View view = GlobalState.database.getView(view_name + “_index”);
// Look at the global knowledge of current live queries, if it doesn’t currently exist, create it
if (GlobalState.live_queries.get(view_name) == null)
{
GlobalState.live_queries.put(view_name, view.createQuery().toLiveQuery());
}
// Retrieve the live query, add the listener, and start it
GlobalState.live_queries.get(view_name).addChangeListener(new LiveQuery.ChangeListener()
{
@Override
public void changed(LiveQuery.ChangeEvent event)
{
process_row_changes(event.getRows());
}
});
GlobalState.live_queries.get(view_name).start();
And “process_row_changes(event.getRows());” is just a function that (right now) logs a message about being called.
As I mentioned earlier – edit and create actions are picked up via sync-gateway and I see log messages on the mobile device that live query picked up the changes, but when a deletion occurs nothing fires off.
Any help on detecting the deletion would be greatly appreciated.
Thanks!