• Type: Icon: Sub-task Sub-task
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Builder, Docs Examples
    • None
    • 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?

      How to use the aggregation builder to perform an actual aggregation

      // code placeholder
      

      How to create custom operator factories

      use MongoDB\Builder\Expression;
      use MongoDB\Builder\Expression\ResolvesToString;
      use MongoDB\Builder\Pipeline;
      use MongoDB\Builder\Stage;
      
      function lcfirst(ResolvesToString|string $expression): ResolvesToString
      {
          return Expression::concat(
              Expression::toLower(
                  Expression::substr($expression, 0, 1),
              ),
              Expression::substr(
                  $expression,
                  Expression::subtract(
                      Expression::strLenCP(
                          $expression,
                      ),
                      1,
                  ),
                  -1,
              ),
          );
      }
      
      $pipeline = new Pipeline(
          Stage::project(
              lowercaseName: lcfirst(
                  Expression::stringFieldPath('name'),
              )
          ),
      ); 

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

              Created:
              Updated: