Is there any way to manipulate the stale flag ?

I was running some tests, inserting a bunch of data and retrieving it right after with a N1QL query, and after I created an index for a field, querying by that field right after inserting the document was not working. I dug a bit and found some information about the stale flag, and thought that if I set it to false (force a view update before running the query) then I would be able to do the query right after inserting the data.

So is there a way to manipulate this stale flag on a N1QL query ?

1 Answer

« Back to question.

Hi,

N1QL does not yet provide a way to specify the stale parameter.

One option is to upgrade to Couchbase Server 3.0 Beta, which has much faster view index updates. If you do so, please use

CREATE PRIMARY INDEX

to create a primary index on your bucket before querying it via N1QL.

Did it, but didn't help. Will N1QL have a way to specify the stale parameter in the future ?

Yes, there is an open ticket, but it has not yet been scheduled: http://www.couchbase.com/issues/browse/MB-10944

Great thanks, hope it gets more relevance and priority.