Basically, I want to check a schedule field in every document, and if Date.now() falls within the bounds of the schedule, I want to set isActive to true.
{
schedule: {
start: (Date object),
end: (Date object)
},
isActive: false
}
That in itself is simple, but my issue is that this collection can potentially have hundreds of thousands of documents. I also need this to run every 30 minutes using cron.
Is there any way to efficiently do this without totally locking up my application and/or database every 30 minutes for however long it takes?
Do I need to call save() on each document individually or is there a way I can save all of them at once?