Get expiry of a document

I want to get expiry time and cas value of a document.

According to the documentation, this is how we can get expiry:

val doc = collection.get("document-key", GetOptions().withExpiry(true))
val expiry = doc.expiry.get

Above code also gets entire document which would be rather expensive since only thing I need is cas and expiry. Is there a more lightweight way to do that using Scala SDK?

use project() with an empty list to not fetch the document.

1 Like