My mongoDB documents have the following structure:
{
_id: 'objectID',
isFlexible: true, // || false
date: 'date type string',
availability: ['thursday.morning', 'thursday.afternoon', 'thursday.evening']
}
I want to be able to select some of the documents by isFlexible: true and change the date to today's date (this is easy) and also change the availability array to become:
availability: ['friday.morning', 'friday.afternoon', 'friday.evening']
I know I can do this this if I first find all documents, modify them inside the nodeJS/expressJS API and save them afterwards but I'm looking for a solution where this can be done in a single call to mongoDB.
Any help is greatly appreciated.