[SERVER-29193] Current date/time available in Aggregation pipeline Created: 15/May/17 Updated: 03/Apr/23 Resolved: 16/May/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.4.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Dennis Hoefakker | Assignee: | Kelsey Schubert |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
It's very usefull to have the current (server) datetime available in the Aggregation Framework. Also with the 3.4 view functionality. For example i have a very large collection of documents, containing a datetime field, i have created a view which returns this is a nice way. |
| Comments |
| Comment by Kelsey Schubert [ 16/May/17 ] |
|
Hi HoefMeistert, Thanks for the feature request. We're tracking this feature in Thank you, |
| Comment by Dennis Hoefakker [ 15/May/17 ] |
|
The title states "Aggregation pipeline" but it would also be nice if your able to use it in a "normal" find command. Something like : { date : { $gte : $currentDate.month(-1) }} to get all documents machting date field greater and equal to now - 1 month |
| Comment by Dennis Hoefakker [ 15/May/17 ] |
|
And the moment we can project a new ISODate to a field, that works, but a variable would also be nice (and documented { $project : { current : new ISODate() }} The problem i have with this "solution" is that i lost my index, because i first need to project My question of inserting in a document is wrong, you want to use it in the first match stage (currentDate.month(-1) or something similar) |