I need to design a schedule schema in mongodb, the original data format is something like this {"schedule_begin":Date,"schedule_end":Date,"schedule_days_runs":"1111100"}
Note in the schema there is a property schedule_days_runs with data "schedule_days_runs":"1111100". It is 7 days in the week, where '1' represents working and '0' represents not working.
Basically, what application does is to find all the schedules with working in certain date (e.x Monday), that means we need to query the schedule , schedule_start =< one_day <= schedule_end, also ensure the queried schedules are also working on Monday.
A easy solution is to store "1111100" directly into the mongodb in String, only use schedule_start and schedule_end for query, and then use the application logic to get the results. However this solution could be not handy, since usually I would get thousands of queries, and half of the queries are not the answer. For example, to get the working schedules on a specific day '1111100'(the schedule works from Monday to Friday), the results of the query gives me many useless things like '0000011' (the schedule works in weekend).
I am trying to figure out a better solution, can somebody has a better idea?