I’m currently working on the nightlife coordination app and I’ve run into a problem with the user story where a user can add themselves to a bar. When I request the data from the Yelp API, I add a property to it called attendance and save it to the database. When someone clicks the “add me” button, a request is sent to the server and the object is pulled from the database. My problem is that I can’t seem to update the attendance property. This is my model:
const listSchema = new Schema({
list: Array,
location: String,
query: String,
users: Array
});
The array returned from the API request is stored in list. In order to change the attendance property, I called forEach on the array, looking for a match with the bar name. Once a match is found I say “object.attendance++” and call markModified, but it’s still not being updated.