N1QL update not working (behaving strange)!

query

#1

Hi,

I am using couchbase for sometimes and facing a strange behaviour and can’t find any solution.
I am doing an INSERT into db and just after that I am trying to update just a value of a single key of another document. But this is not happening for some first attempts, meaning, if I do like 10 updates, from 5th attempt the value will update fine. But before that it will stay same. Strange!
This is the query I am using

UPDATE default
USE KEYS ‘event::$eventId’
SET child_counter = $theValue
RETURNING child_counter

I tried with running the same above query 3/4 times, but that child_counter value isn’t updated. But if I run this query from the couchbase query tool, it works.

Can anyone please help me! It is months and I still am failing to solve the situation. Thanks!


#2

Update with USE KEYS will not depends on index and it should work. Did you tried with cbq shell or REST API and see if that works. Did you get any error?

As you know the key, update using SDKs directly without N1QL and see if that is working.


#3

I did use REST API to update document before, and as I was facing the problem, I did change to N1QL. After you told I moved to REST API again and now it is working (may be for now). I did some tests, still working. But I want to test 1/2 days more to be sure.
Thanks for your suggestion!