I'm currently try to do a search with PyMongo/Mongo that'll allow to me bring up results of entries within a specific date range. I have a database of apartments that are unavailable on specific dates. Here's an example of what a mongo document looks like at the moment (dates are in format d-m-Y).
"name":"apartmentName",
"unavailability": [
{
"@date_from": "21-01-2013",
"@date_to": "25-01-2013"
},
{
"@date_from": "08-12-2012",
"@date_to": "10-12-2012"
},
{
"@date_from": "06-12-2012",
"@date_to": "08-12-2012"
}
]
Essentially, I need to search for results that don't fall under the range of dates in unavailable. How would I go about this? Any help is appreciated!
Note: I can change the format of the dates if required if it'll make searching easier.