Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23656

Current timestamp variable for aggregate expressions

    • Fully Compatible
    • Query 2019-04-08

      I would like to store aggregate pipelines in a collection, which will make them easier to re-use in my company's multiple applications. We will need to add new aggregates often and this seems like the easiest way to allow each application to programmatically accommodate new aggregates inserted from a single administrative panel.

      The main problem I've encountered is specifying the current date within the aggregate itself without injecting it at runtime, which is a little clumsy. '$currentDate' exists to update a document, but there is nothing similar for aggregates.

      I'm proposing a '$$NOW' variable that can be used in aggregation expressions to represent the current datetime when evaluated.

            Assignee:
            martin.neupauer@mongodb.com Martin Neupauer
            Reporter:
            bmanturner Brendan Turner
            Votes:
            15 Vote for this issue
            Watchers:
            28 Start watching this issue

              Created:
              Updated:
              Resolved: