2017 © Pedro Peláez
 

library php-mongodb-helpers

MongoDB php helpers to build queries

image

thesebas/php-mongodb-helpers

MongoDB php helpers to build queries

  • Wednesday, August 30, 2017
  • by thesebas
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

php-mongodb-helpers

MongoDB php helpers to build queries. BUILD STATUS Coverage Status, (*1)

Write this:, (*2)

$collection->aggregate([

  project([
      'field' => reduce(
          filter(
              path(...$arrayField),
              'tmp',
              eq(variable("tmp", ...$filterField), $filterValue)
          ),
          0,
          add(variable('value'), variable("this", $sumField))
      )
  ])

]);

instead of this:, (*3)

$collection->aggregate([
  ['$project' => [
      'field' => ['$reduce' => [
          'input' => ['$filter' => [
              'input' => '$' . join('.', $arrayField),
              'as' => 'tmp',
              'cond' => ['$eq' => ["\$\$tmp." . join('.', $filterField), $filterValue]]
          ]],
          'initialValue' => 0,
          'in' => [
              '$add' => ['$$value', '$$this.' . $sumField]
          ]
      ]]
  ]]
]);

The Versions

30/08 2017

dev-master

9999999-dev

MongoDB php helpers to build queries

  Sources   Download

The Requires

  • php ^5.6|^7.0

 

The Development Requires

28/08 2017

0.0.3

0.0.3.0

MongoDB php helpers to build queries

  Sources   Download

The Requires

  • php >=5.6

 

The Development Requires

14/08 2017

0.0.2

0.0.2.0

MongoDB php helpers to build queries

  Sources   Download

The Requires

  • php >=5.6

 

The Development Requires

14/08 2017

0.0.1

0.0.1.0

MongoDB php helpers to build queries

  Sources   Download

The Requires

  • php 5.6

 

The Development Requires