i'm trying increment counter value in firebase database using transactions. works first time, i.e. when value set 1, on updates after that, value isn't updating.
here's how code:
firebaseref.child("search_hashtags").child(hashtag).transaction(function(currentvalue) { return (currentvalue || 0) + 1; }, function(error, committed, ss) { console.log(error); console.log(committed); console.log(ss); });
the error log says "[error: set]"
i turned on firebase logging , i'm getting this:
p:0: server: {"r":3,"b":{"s":"ok","d":""}} p:0: p response {"s":"ok","d":""} p:0: handleservermessage d {"p":"search_hashtags/test","d":1} p:0: server: {"r":4,"b":{"s":"ok","d":{}}} p:0: listen response {"s":"ok","d":{}} p:0: server: {"r":5,"b":{"s":"datastale","d":"transaction hash not match"}} p:0: p response {"s":"datastale","d":"transaction hash not match"} 0: transaction put response {"path":"/search_hashtags/test","status":"datastale"}
i'm doing similar transactions on other nodes in other parts of code , work fine, reason 1 fails...
Comments
Post a Comment