Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-1634

Builder: Accept DateTimeInterface objects where "date" values are accepted

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.21.0
    • Affects Version/s: None
    • Component/s: Builder
    • None
    • PHP Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When passing a date to the aggregation builder, it would be convenient not having to convert it into UTCDateTime. The Aggregation Builder could accept any DateTimeInterface object and convert them automatically in the BuilderEncoder.

      This would make sense for Laravel where we already convert DateTimeInterface into UTCDateTime. We cannot pass DateTimeInterface to the aggregation builder because of type restrictions.

       

      Example where it could be used: https://github.com/mongodb/laravel-mongodb/pull/3272#discussion_r1968250082

            Assignee:
            andreas.braun@mongodb.com Andreas Braun
            Reporter:
            jerome.tamarelle@mongodb.com Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: