Yes. Use the changes API <http://developer.couchbase.com/mobile/develop/references/couchbase-lite/rest-api/database/get-changes/index.html>, not _active_tasks, to get notified of data changes. Active tasks is about things like replication status or view building, the changes API can tell you exactly which documents changed.
Chris On Friday, December 19, 2014 2:14:53 AM UTC-8, Vinay Bhinde wrote: > > I have successfully established sync across android and ios devices > running cordova apps with sync gateway. I am now facing few issues updating > the UI when new change is pulled down by the app from SG. > > I read about querying the _active_tasks api to get status of the > replication in this post > <https://groups.google.com/forum/#!searchin/mobile-couchbase/sync$20progress$20phonegap/mobile-couchbase/JRZbjSSDd8s/KB0nXk9PDv4J> > > but i am not sure how do i pass the continuous parameter to _active_changes > API. What i want is someway to fire a event or do something whenever my > cblite receives something new from SG so that i can call my code which > updates my UI only when it receives new documents from SG. I tried the > below code but it does not work. > > coax([config.server, "_active_tasks"], { continous: true }, function(err, > tasks) { > var me; > for (var i = tasks.length - 1; i >= 0; i--) > { > if (tasks[i].task == id) > { > me = tasks[i]; > } > } > console.log(me); > }); > > > The logic i have with me should be run only when there is a new document > inserted in cblite from SG and not when changes are made to local cblite. > > > Any ideas ? > > > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to mobile-couchbase+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/f990aecc-7a75-4953-b8aa-6801d913571b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.