How to add TTL in N1QL query

When i using insert or update couchbase nodejs client there is a option to add ttl for a document.

But how can i add ttl option when i using n1ql query (INSERT or UPSERT) function. is there option available?

N1QL queries will not allow modify/set TTLs. You need to use SDKs.

Hi @gopimr2,

I know it’s been almost 3 years but I cam across your post please refer to as of 6.5.1 (released on 2020-Apr-20) this can now be done in N1QL examples:

INSERT INTO default (KEY, VALUE) VALUES ("k01", {"id":"k01"}, {"expiration":10*60});

UPSERT INTO default (KEY, VALUE) VALUES ("k01", {"id":"k01"}, {"expiration":10*60});