How to partially update a document

Many times, it is very convenient to only update one attribute instead of loading everything into memory and then pushing everything onto the wire, specially when a few changed (let say only 1% had changed).

I did not find any element, except an issue opened from 2012/06 (, on how to partially update an existing document.

It seems like Couchbase only allow full update.

I was expecting that in N1QL one could do some commands such as:
- UPDATE (in particular this one)

But it seems not (event if Keywords are reserved) and that N1QL is only focusing on SELECT (and yes some others like INDEX creation or droping).
In Java JDK 2.0, I can see the following :
- get (equivalent to SELECT with KEYS keyword for 1 item)
- query (where N1QL takes place)
- insert (equivalent to INSERT)
- remove (equivalent to DELETE except there is no "WHERE" condition)
- replace and upsert : those ones are not clear
What are the differences ? first one making an update only if it exists before, second making insert or replace (therefore not taking into account really its existence) ?
Moreover is there one enabling the "partial" update ? or are they both as "full" update ?

If this is not yet available, when do you think it will be?


1 Answer

« Back to question.

Hi Frederic,

N1QL DP4 and beyond will include the following statements:


These will be analogous to their SQL equivalents, plus additional JSON / document capabilities (e.g. arrays and nested objects).

DP4 is still a preview version. It will be available in a couple of months.


OK, I understand. The dev is on going ;-)