[SERVER-9626] Aggregation Framework needs to support more date conversion functions like date portion, or time portion of date type Created: 08/May/13 Updated: 03/Jan/18 Resolved: 11/Mar/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Gordon Roylance | Assignee: | Benjamin Murphy |
| Resolution: | Duplicate | Votes: | 9 |
| Labels: | expression, usability | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||
| Description |
|
It would be very useful to have additional date conversion operators that would take a Date and return a date that only includes the date portion (time portion would be 0). Likewise for a getting the time of the day without the date. Currently it is not possible (or at least not easily done) to group on the date of a Date field and have the date returned to the pipeline. This wouldn't be too difficult to workaround if we could $divide a date, and then group on it, but it's not supported. Other possible conversions may be nice like converting a Date to a Long, etc.. |
| Comments |
| Comment by Charlie Swanson [ 11/Mar/16 ] | |
|
I'm closing this ticket as a duplicate of If anyone has additional requests besides the functionality described in | |
| Comment by Petri Liimatta [ 10/Jun/15 ] | |
|
Enabling Date construction in aggregation would be a good start. Currently it is not possible to execute
This would enable date aggregation operators like $year, $month and $dayOfMonth later in next pipeline steps. | |
| Comment by Asya Kamsky [ 29/Jan/14 ] | |
|
It's certainly possible to do this in 2.4 using date math, but I agree that it's unwieldy and slightly ugly so this would be useful syntax to have/use. | |
| Comment by Joerek van Gaalen [ 13/May/13 ] | |
|
In addition to this request. It would be useful to add to the date fuctions in the AF a unix timestamp function (milliseconds since 1970). With such an option you can group on any given time interval (for example 86400 seconds, or even per 4 hours: 14400 seconds) etc.. without having to stick with the $year, $dayOfYear functions |