Counter has an issue with expiry


#1

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?


#2

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


#3

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.


#4

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


#5

@daschl thanks will try that