Sign In Register

How can we help you today?

Start a new topic

About new Data service, how to keep data atomic like findAndModify?

I may have multiple script to write the same data.

2 people have this question

Well I would like to hear the answer on Daniel question also. This is very important stuff. Atomic functions are essential if you have more players messing with same data. Running loop and hope for "true", this cant be right, can it?

1 person likes this

Did anyone get this working? I'm trying to be optimistic, but I don't think i'll be able to adopt using Game Data Service in my game, and will have to continue to use the now unsupported MongoDB.

It seems very messy to have a while loop with re-try logic in the cloud code. Are people actually doing this? Can you share if it's working OK?


im not sure if this is what u need..  withOverwrite()

Hi Jo,


In the new system, obtaining and editing records are performed in distinct operations, so there's no direct equivalent to findAndModify. You'd first obtain your data (getItem), perform your changes, and then set them (persist). You can perform your persist with version control enabled, which will check that the record hasn't been changed since you obtained it before performing the update:








Hi Vinnie,

Can you please elaborate more on the "will check that the record hasn't been changed"? It will only return some bool so we must "getItem" again (possibly wrapped in some while iterator and wait)? Or it will obtain lock and wait for the other query execution and then executes? According to documentation it seems the first option is right. If so, then I think it is so inpractical, Mongo handled it itself before...



Login to post a comment