Meta().expiration different from expiration in meta()

At the attention of Couchbase team,
I noticed that meta().expiration and expiration in meta() have two different values.

For examples:

SELECT meta().expiration FROM bastard WHERE meta().id = '8e956674-014e-4d6e-b46b-79ba7f916089'
[
  {
    "expiration": 1681383097
  }
]

Where instead:

SELECT meta() FROM bastard WHERE meta().id = '8e956674-014e-4d6e-b46b-79ba7f916089'
[
  {
    "$1": {
      "cas": 1678704697273352200,
      "expiration": 0,
      "flags": 33554438,
      "id": "8e956674-014e-4d6e-b46b-79ba7f916089",
      "keyspace": "default:bastard",
      "type": "json"
    }
  }
]

It interesting to note that if I use the two attributes together, then the correct value is returned:

SELECT meta(), meta().expiration FROM bastard WHERE meta().id = '8e956674-014e-4d6e-b46b-79ba7f916089'
[
  {
    "$1": {
      "cas": 1678704697273352200,
      "expiration": 1681383097,
      "flags": 0,
      "id": "8e956674-014e-4d6e-b46b-79ba7f916089",
      "type": "json",
      "xattrs": {
        "$document.exptime": 1681383097
      }
    },
    "expiration": 1681383097
  }
]

I am using Community Edition 7.1.1 build 3175.
To do these examples I used the UI interface of Couchbase.

It’s intentional for performance.

See Loading... and Loading...

1 Like

That is expected.
To get expiration it needs to use special API, due to performance reason unless query explicitly uses META().expiration it will avoid the special API.

I understand. Thank you for your fast answer. :+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.