All,
TL:DR
- Appcelerator Cloud Services
- REST
- Custom Object with arrays
- Update property in an array using $inc atomic increment operator
Details:
I am using AngularJS to access Appcelerator Cloud Services using REST. I have a complex custom object (see Gist links below). My custom collection will contain one of these objects per event. Each event has teams, and each team has contestants. Each team and contestant competes in event segments, and the audience votes on team and contestant performance. I want to update team and contestant scores, but I can't figure out how I need to set the fields value in order to update scores.
I've created a gist with all my files that are involved in this issue. If anyone could please provide some assistance I'd appreciate it.
I gave up and changed the score object to a flat document. I now have a score document per event/team/segment or event/contestant/segment. This should allow the score property to be updated easily since there are now no hashes or arrays in the score document.