I`m using this python driver. How can i increment counter using ORM in correct way?
Maybe smth like update(counter_value__add=1)
or obj.counter_value += 1
?
I try to avoid this manual query UPDATE ... SET counter_value = counter_value + 1
Resolved issue which tell, that correct way is obj.counter_value += 1
But its deprecated!
Right way is:
CounterModel(pk=pk, ck=ck).update(counter_field=1, another_counter=-2)
Also you can use update method of counter model object.
P.S.
0
by default..create()
method.