PHPackages                             connectholland/mongo-aggregations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. connectholland/mongo-aggregations

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

connectholland/mongo-aggregations
=================================

Library allowing easy access to the mongo aggregate framework

1.3.1(10y ago)13.2k3[6 issues](https://github.com/ConnectHolland/MongoAggregations/issues)MITPHP

Since Nov 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ConnectHolland/MongoAggregations)[ Packagist](https://packagist.org/packages/connectholland/mongo-aggregations)[ RSS](/packages/connectholland-mongo-aggregations/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

[![Build Status](https://camo.githubusercontent.com/03b81feda172fe58c8ec04a8838675cf13080cd38361f3d0da4ecd9eca2915b1/68747470733a2f2f7472617669732d63692e6f72672f436f6e6e656374486f6c6c616e642f4d6f6e676f4167677265676174696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ConnectHolland/MongoAggregations)[![StyleCI](https://camo.githubusercontent.com/08fa2020f37d212229e80f9a018fede9c6a98e6bdeabd12f3140a668f01f5d2c/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353539373331302f736869656c64)](https://styleci.io/repos/45597310)[![Latest Stable Version](https://camo.githubusercontent.com/be44fce9c510f512fa63e14fcc9f3a3e9a15aed6e51d789d9a553fad3dee796f/68747470733a2f2f706f7365722e707567782e6f72672f636f6e6e656374686f6c6c616e642f6d6f6e676f2d6167677265676174696f6e732f762f737461626c65)](https://packagist.org/packages/connectholland/mongo-aggregations) [![Total Downloads](https://camo.githubusercontent.com/ef3753373b3c64f818dd5438a4e6165077ec5e8f2688d1122e6098240cc1afdf/68747470733a2f2f706f7365722e707567782e6f72672f636f6e6e656374686f6c6c616e642f6d6f6e676f2d6167677265676174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/connectholland/mongo-aggregations) [![Latest Unstable Version](https://camo.githubusercontent.com/a42024167155e10dc7a186ac214b688883ec0061285e325ebe89862a6956fca3/68747470733a2f2f706f7365722e707567782e6f72672f636f6e6e656374686f6c6c616e642f6d6f6e676f2d6167677265676174696f6e732f762f756e737461626c65)](https://packagist.org/packages/connectholland/mongo-aggregations) [![License](https://camo.githubusercontent.com/016f3516bcc78a932967523f77cfa991d72297daee901c88b3779f1efa3d46ba/68747470733a2f2f706f7365722e707567782e6f72672f636f6e6e656374686f6c6c616e642f6d6f6e676f2d6167677265676174696f6e732f6c6963656e7365)](https://packagist.org/packages/connectholland/mongo-aggregations)[![SensioLabsInsight](https://camo.githubusercontent.com/25c09ca693bf1a6d566c67148f6101334ff752bd553f7491ee1841a5c76ca0af/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30313635333930312d663637382d346231322d396463382d3363396562373664396166342f6d696e692e706e67)](https://insight.sensiolabs.com/projects/01653901-f678-4b12-9dc8-3c9eb76d9af4)

MongoAggregations
=================

[](#mongoaggregations)

Library allowing easy access to the mongo aggregate framework

Builders
--------

[](#builders)

This library constructs aggregation pipelines using builders. You can add stages (instances of AggregationInterface), collections of stages (AggregationBags) or other builders to construct your pipeline. A special builder is the UnwindBuilder. This Builder will create a pipeline that can unwind both strings and arrays and databases that has the two mixed (the latter should be avoided). Basically the builder will transform any mongo field to an array and then unwind that array.

Example usage of the UnwindBuilder is in its Test:

Supported stages
----------------

[](#supported-stages)

This library currently supports the following stages in the aggregate framwork:

ClassOperatorDescriptionMatch$match[https://docs.mongodb.org/manual/reference/operator/aggregation/match/#pipe.\_S\_match](https://docs.mongodb.org/manual/reference/operator/aggregation/match/#pipe._S_match)Project$project[https://docs.mongodb.org/manual/reference/operator/aggregation/project/#pipe.\_S\_project](https://docs.mongodb.org/manual/reference/operator/aggregation/project/#pipe._S_project)Unwind$unwind[https://docs.mongodb.org/manual/reference/operator/aggregation/unwind/#pipe.\_S\_unwind](https://docs.mongodb.org/manual/reference/operator/aggregation/unwind/#pipe._S_unwind)Group$group[https://docs.mongodb.org/manual/reference/operator/aggregation/group/#pipe.\_S\_group](https://docs.mongodb.org/manual/reference/operator/aggregation/group/#pipe._S_group)Sort$sortRangeProjectionA ranged projection stage, a special kind of $project which can map ranges (for example: 1 to 10) to strings (for example to 'low').Supported operations
--------------------

[](#supported-operations)

Within the stages operations can be used, these are currently supported:

ClassOperatorDescriptionSum$sum[https://docs.mongodb.org/manual/reference/operator/aggregation/sum/#grp.\_S\_sum](https://docs.mongodb.org/manual/reference/operator/aggregation/sum/#grp._S_sum)Condition$cond[https://docs.mongodb.org/manual/reference/operator/aggregation/cond/#exp.\_S\_cond](https://docs.mongodb.org/manual/reference/operator/aggregation/cond/#exp._S_cond)Push$push[https://docs.mongodb.org/manual/reference/operator/aggregation/push/#grp.\_S\_push](https://docs.mongodb.org/manual/reference/operator/aggregation/push/#grp._S_push)WeekOperation$weekFieldOperationRename a field in a projection (example: `{$project: {my_field: {'$some.field.hidden.in.complex.nesting'}}}`)ArrayOperationAdd an expression in a projection using a mongo array (example: `$operation = new ArrayOperation(['$year' => '$somedate'])`)EmbeddedCollections
-------------------

[](#embeddedcollections)

The library adds a class EmbeddedCollection which can be used to create a (temporary) collection that embeds documents that another collection has referenced.

**Stages or operations that aren't supported by the library, can still be used by constructing arrays. However, creating a class and the abstraction layer that comes with that is to be preferred.**

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

10

Last Release

3799d ago

Major Versions

0.1.0-RC2 → 1.0.02015-11-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2697738?v=4)[Ron Rademaker](/maintainers/RonRademaker)[@RonRademaker](https://github.com/RonRademaker)

---

Top Contributors

[![RonRademaker](https://avatars.githubusercontent.com/u/2697738?v=4)](https://github.com/RonRademaker "RonRademaker (95 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/connectholland-mongo-aggregations/health.svg)

```
[![Health](https://phpackages.com/badges/connectholland-mongo-aggregations/health.svg)](https://phpackages.com/packages/connectholland-mongo-aggregations)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M986](/packages/statamic-cms)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k3.5k](/packages/leantime-leantime)[silverstripe/framework

The SilverStripe framework

7313.7M2.8k](/packages/silverstripe-framework)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
