I'm building an app and the end user will be using an Admin screen to schedule content on the front page. They will be choosing two dates, a start date and an end date.
Obviously I don't want to cycle through the entire collection to see if todays date is between any of the start or end dates every time the front page loads.
Also, don't want the user to be able to schedule two things that overlap each other. There should be a better way than checking for conflicts with each record before saving.
I could index the collection in Mongo then sort accordingly to test for today's date and make sure there aren't conflicting schedules. Also, I could have a flag that is set once the day changes that signifies current content. I thought there might be a better way.
Does anyone have any thoughts?