MongoDB finding documents that are valid on a specific date <p>I have some data stored in a mongodb collection similar to:</p> <pre><code>{"_id": 1, "category": "food", "name": "chips", "price": 1.50, "effectiveDate": ISODate("2013-03-01T07:00:00Z")} {"_id": 2, "category": "food", "name": "chips", "price": 1.75, "effectiveDate": ISODate("2013-03-05T07:00:00Z")} {"_id": 3, "category": "food", "name": "chips", "price": 1.90, "effectiveDate": ISODate("2013-03-10T07:00:00Z")} {"_id": 4, "category": "beverage", "name": "pop", "price": 2.00, "effectiveDate": ISODate("2013-03-01T07:00:00Z")} {"_id": 5, "category": "beverage", "name": "pop", "price": 2.25, "effectiveDate": ISODate("2013-03-05T07:00:00Z")} {"_id": 6, "category": "beverage", "name": "pop", "price": 1.80, "effectiveDate": ISODate("2013-03-10T07:00:00Z")} </code></pre> <p>In mongodb, how would I go about writing a query that would return the documents that were active on a specific date, grouped by the category.</p> <p>If I specified March 6, 2013 i'd expect to see the results:</p> <pre><code>{"_id": 2, "category": "food", "name": "chips", "price": 1.75, "effectiveDate": ISODate("2013-03-05T07:00:00Z")} {"_id": 5, "category": "beverage", "name": "pop", "price": 2.25, "effectiveDate": ISODate("2013-03-05T07:00:00Z")} </code></pre> <p>I am new to mongo and have been trying to do this using group, aggregate and mapreduce but have been just spinning in circles.</p> <p>Thanks in advance!</p>