N1QL query for removing property field from couchbase document?

I have couchbase document like:

{
“_type”: “activity”,
“name”: “october08”
“count”: “35”,
“_id”: “00ae5de2-c62c-4689-ba2d-2bb1e8b7563a”
}

I want to remove count property from couchbase document.
How to query the above scenario ?

1 Like

You can select fields required

SELECT _type, name,_id
FROM default
WHERE .....

OR

SELECT OBJECT_REMOVE(d,"count") AS d 
FROM default AS d
WHERE ....;

https://docs.couchbase.com/server/5.5/n1ql/n1ql-language-reference/objectfun.html#object_remove

1 Like

Actually I was looking for this,

UPDATE default UNSET count WHERE … ;

This will remove count from existing couchbase document

Thanks…

3 Likes