Modeling shift planning app:

I came up with such data structure describing the `shift`.

```
{
    "fromHour" : 7,
    "fromMinute" : 30,
    "toHour" : 9,
    "toMinute" : 30,
    "week" : 5,
    "date" : "2015-01-26",
    "user" : {
       // ...
    },
    "_id" : ObjectId("54d0e4a82b9dc26c0c0f36e7")
}

```

The main thing that I need to store is the information:
1. when shift starts (hour and minute), 
2. when shift ends (hour and minute) and 
3. what date it's actually happening. 

The fields `fromHour`, `fromMinute`, `toHour`, `toMinute` and `date` as ISO string worked pretty good for me for storing and querying the shifts by particular date.

The problem occurred when I needed to build reports out of it. Say, I want to get all shifts from "2015-01-01" to "2015-02-01" in range from 07:00, till 23:00.

I can add `$and` clause to my query, like

```
[ { fromHour: { '$gte': 7 } },
  { fromMinute: { '$gte': 0 } },
  { toHour: { '$lt': 23 } },
  { toMinute: { '$lt': 0 } } ]

```

But that doesn't work good, since for shift there `toMinute` is 30 the `$lt` will be false.

I'm trying to find efficient data structure that would allow to store timespans that would be easy to query.