CBLLiveQuery Instance not recognizing added document

I create a live query from a view and assign it to a CBLTableSource that drives my view. In this view I enter some data and then press a button that adds a document with this data to my database.

I have enable logging for Sync and Query on CBLManager. When the save method is called on my new document, I can see the SYNC progress logging replicating my document with my server, and I see a different live query of which one of the objects I access during the creation of my new document logging Rows changed!, but the live query that the document is added to does not update (or at least show this in the logs).

I know it is adding it to the correct view/query because upon called liveQuery.stop(); liveQuery.start() the document shows up and then logging shows that it notices rows have changed. Without calling these, the document doesn’t show up until I reload the view controller, at which point the query logs the change.

Any help would be appreciated, thank you for your time.

I am using an iPhone 5s running iOS 8.3 and the latest version of the Sync Gateway, CB Server, and CouchbaseLite framework

Sounds like you’ve got Query logging enabled already since you see the Rows changed! message from the other query. In that case, do you see the problematic query logging something like CBLLiveQuery[...]: Async query dbname/viewname...? That message gets logged when the LiveQuery detects a database change and re-runs the underlying query.

If you’re getting that message, but not the Rows changed! logged by the same query, it indicates the query results didn’t change. Maybe due to a bug the map function doesn’t emit anything for your new document.

If you’re not even getting the Async query... message, something weirder is wrong…

Unfortunately, I am not seeing any message concerning the query in question until stop and start is called again. My logs are here (postByDate is the troublesome query):

2015-06-05 20:25:35.480 xxx[11046:3729961] SYNC progress: 2 / 3
2015-06-05 20:25:35.482 xxx[11046:3729961] Query: CBLLiveQuery[byName]: Async query database3/byName…
2015-06-05 20:25:35.561 xxx[11046:3729961] Query: CBLLiveQuery[byName]: …async query finished (3 rows)
2015-06-05 20:25:37.310 xxx[11046:3729961] SYNC progress: 3 / 4
2015-06-05 20:25:50.611 xxx[11046:3729961] Query: CBLLiveQuery[byName]: Will update after 0 sec…
2015-06-05 20:25:50.612 xxx[11046:3729961] SYNC progress: 4 / 4
2015-06-05 20:25:50.613 xxx[11046:3729961] Query: CBLLiveQuery[byName]: Async query database3/byName…
2015-06-05 20:25:50.646 xxx[11046:3729961] Query: CBLLiveQuery[byName]: …async query finished (3 rows)
2015-06-05 20:25:50.646 xxx[11046:3729961] Query: CBLLiveQuery[byName]: …Rows changed! (now 3)

*** Calls function to add document ***

2015-06-05 20:25:50.650 xxx[11046:3729961] SYNC progress: 4 / 5
2015-06-05 20:25:50.686 xxx[11046:3729961] SYNC progress: 5 / 5
2015-06-05 20:25:51.139 xxx[11046:3729961] SYNC progress: 5 / 6
2015-06-05 20:25:51.258 xxx[11046:3729961] SYNC progress: 6 / 7

*** calls stop() & start() from viewWillDisappear and viewWillAppear (switching tabs) ***

2015-06-05 20:25:58.377 xxx[11046:3729961] Query: CBLLiveQuery[postByDate]: Async query database3/postByDate…
2015-06-05 20:25:58.422 xxx[11046:3729961] Query: CBLLiveQuery[postByDate]: …async query finished (18 rows)
2015-06-05 20:25:58.423 xxx[11046:3729961] Query: CBLLiveQuery[postByDate]: …Rows changed! (now 18)

  • app name replaced with xxx