Views not updating

I was pleased to realise I could create and query views via the sync gateway rest api on the admin port. I have been doing some tests and am having a problem with views updating.

If I add a design doc with views, then add a couple of docs using puts via the sync gateway and then query the view that ought to include the new docs they are not listed. If I use the web console to check the view they are there. If I try querying again after checking in the console then I get the correct response. It looks like the couchbase server views are not being updated when new documents are added via sync gateway but are if nudged in the console.

Is there some way to ensure the views are updated on writing new docs, or can I specify something in the query (a reference to DB state from the previous puts?) to ensure the new documents are included?

Maybe there’s some caching going on somewhere? :wink:



1 Like

I have done some more tests.

It appears that documents added via the sync gateway are not indexed by the views on write but instead the view is indexed lazily after a read so that every first view query fails.

This looks like a bug so I’ll raise a ticket for it.


I’ve had the same problem, I think the phrase used to describe such behaviour is ‘eventual consistency’.

I raised a ticket and it looks like there may be a solution that would allow views to be used in sync gateway without compromising write speeds.