Gianluca Nitti

My feedback

  1. 1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Database » Query and Aggregation Pipeline  ·  Flag idea as inappropriate…  ·  Admin →

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Gianluca Nitti commented  · 

    Thanks for the clarification.

    Yes, support for constant expressions would be enough for my use case.

    In fact, what I need is exactly to $dateTrunc a date that comes from user input. I could do it in my application code, however the application is structured in a way where I have various pipelines saved as JSON with "placeholders" where parameters coming from the end user are replaced right before sending the pipeline to MongoDB for execution; these parameters are not always dates and when they are they don't always need to be truncated, so having the ability to truncate them directly in the pipeline would result in cleaner code on the application side since I wouldn't have to save somewhere else the information on which parameters must be "preprocessed" and handle them separately.

    So, when the pipeline is sent to MongoDB it would contain an expression exactly like the one you posted, with two $dateTrunc operations with constant dates as input.

    Gianluca Nitti shared this idea  · 

Feedback and Knowledge Base