Sign In Register

How can we help you today?

Start a new topic

lost trying to store only 1 number on nosql

everytime i save data it keeps updating into a new document on the nosql runtime collection and I tought It should be replacing the value.


I just want to have 2 players in a match, and everytime one of them presses a button a number called cardsLeft gets decremented by one.


thats all.


none of the exapmles are similar and Im really stupid, thank you for your time


I have an event with 2 attributes, both numbers, match and cardsLeft.


i want to update cardsLeft for the particular match number

image


image



Hi Adam,


Can you try replacing your update Cloud Code with the following?


raceData.update({"match":match},{$set: {"cardsLeft":cardsLeft}});


-Pádraig

sorry I didnt mean to post it twice, I have bad internet and didnt notice the moderation warning the first time.


i guess I misunderstood what $set did, because yeah that almost worked perfectly. I had to keep the true and false.


thank you very much i've spent so long on this before giving up and asking here. never used SQL stuff before and was/am lost.


attached is how i am getting 2 variables from event data, and updating one with respect to the other if it ever helps anyone



image


Login to post a comment