Last active
August 29, 2015 13:56
-
-
Save joshuaadickerson/9202010 to your computer and use it in GitHub Desktop.
Date and Time Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This checks for US President's elections | |
| // With a hypothetical reporting of election results every other hour between 8 AM and 8 PM | |
| {'check': { | |
| 'value': 'now', | |
| 'date': [ | |
| {'year': {$gt: 1775}}, | |
| {'year': 'leapyear'}, | |
| {'month': 'november'}, | |
| {'dayofweek': 'tuesday'}, | |
| {'count': [ | |
| {'month': {'dayofweek': 'tuesday'}}, | |
| 1 | |
| ]}, | |
| {count': [ | |
| {'month': {'dayofweek': 'monday'}}, | |
| 1 | |
| ]}, | |
| ], | |
| 'time': [ | |
| { | |
| 'hour': { | |
| '$between': [8, 20] | |
| } | |
| }, | |
| { | |
| 'hour': {'step': 2} | |
| } | |
| ] | |
| }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {iterator: { | |
| 'by': 'date', | |
| 'format': 'Y/m/d', | |
| 'when': { | |
| 'date': [ | |
| {'$dayofweek': 'tuesday'}, | |
| { | |
| '$year': { | |
| 'between': [2012, 2014] | |
| } | |
| }, | |
| { | |
| '$or': [ | |
| {'$year': 2012}, | |
| {'$year': 2013}, | |
| {'$year': 2014} | |
| ] | |
| } | |
| ] | |
| } | |
| }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment