Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is the easiest way you can:
- var thisDate = ISODate("2016-01-07T00:00:00Z");
- Model.find({
- startDate: {
- '$lte': thisDate
- },
- endDate: {
- '$gte': thisDate
- }
- });
- It will return all docs (in array) in which `startDate` greater than or equals to `thisDate` and `endDate` less than or equals to `thisDate`
- For `counts` use `.length()` on your received collection which is array so .length() will return you count easily..
- Hope this helps.
- Cheers,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement