Expiry on the document is always 0 when meta() information is retrieved

I am inserting data into my Couchbase bucket and also defining the Document Expiry along with it, and I am able to successfully insert them.

Sample Code:
document = new Document
Id = “TEST_” + $"{logLevel}_" + DateTime.UTCNow.ToString(yyyy-MM-dd),
Content = new TestModel(log),
Expiry = 24 * 60 * 60 * 1000,
var result = await this.Bucket.InsertAsync(document).ConfigureAwait(false);

this is successfully inserted, when i try to retreive meta() information using N1QL query, The Expiry is always returned as 0

            "$1": {
                "cas": 1614631205323145216,
                "expiration": 0,
                "flags": 33554433,
                "id": "TEST_Information_2021-03-0120:40:05.106",
                "type": "json"

Can someone please suggest, why the expiration is returned as 0 even though it is set to a day

META() function returns expiration value to 0 Indexing Metadata Information | Couchbase Docs . In 6.6.0 and above If you use META().expiration it will returns right value.
To retrieve expiration it needs special call(avoid over head special call is made when the META().expiration referenced explicitly in the query).

1 Like