I'm new to the Parse api and am trying to figure out how to do the following:
My app stores strings ("foo", "bar", etc). "foo" should only exist once no matter how many times users attempt to add it - along with a count of how many times that string was attempted to be added. Thus if four users attempt to add the string "foo" I'd like the associated PFObject
to look like:
name: "foo"
count: 4
(there should never be more than one object with a name of "foo")
I know what I could query for "foo", retrieve it, and then update the count but I have a feeling that a race condition would exist if multiple users are trying to update "foo" at the same time.
What is the right/best way to achieve this via the Parse API (I'm using iOS if it matters).