Get TTL value in seconds

How can I get TTL of document when

  • I use lookupIn
  • I use get

Any idea? Is it possible?

Hey @socketman2016,

It is unfortunately not possible to fetch the TTL of the document when performing a standard get operation, as this is usually maintained as internal state only. It is however possible to fetch the expiry using our subdocument API.

Something like this should work:

  .get('$document.exptime', {xattrMacro: true})
  .execute((error, result) =>{
    // ...

Cheers, Brett

1 Like