N1QL query for removing property field from couchbase document?


#1

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 ?


#2

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


#3

Actually I was looking for this,

UPDATE default UNSET count WHERE … ;

This will remove count from existing couchbase document

Thanks…