Counter has an issue with expiry


If I call the counter() method with an expiry in the options parameter the increment/decrement doesn’t happen. Only if I set the expiry as 0 the increment/decrement is successful.

Is this a know issue?


Hey @krishan1390,

The expiry is not mutable during counter operations (except when the key is first created). If you wish to update the expiry on these documents, you can perform a touch operation on the document once you’re counter operation has succeeded.

Cheers, Brett


Hey @brett19

Thanks for the reply. That is what I am doing right now. Thought of moving the expiry to counter to reduce the number of operations.


@krishan1390 if you can afford changing your data model a bit you can switch to “subdocument counters” which if I remember correctly support that.


@daschl thanks will try that