Couchbase get non expiring documents via n1ql

Hi,

Is there any way that I can get the non expiring documents via n1ql ?

Thanks,
Himanshu

CREATE INDEX ix1 ON default(MTEA().expiration);
SELECT RAW META().id FROM default MTEA().expiration > 0;

This gives document keys that has set expiration and not expired.

SELECT RAW META().id FROM default MTEA().expiration = 0;
This gives documents that have no expiration date.

Example 1: https://docs.couchbase.com/server/6.0/n1ql/n1ql-language-reference/indexing-meta-info.html

.expiration

Value representing a document’s expiration date. A value of 0 (zero) means no expiration date.

Note that this property gives correct results only when used in a Covered Index.

1 Like