Simple and swift MongoDB abstraction.
A simple and swift MongoDB abstraction layer for PHP 5.4+
Monga was created with the acknowledgment of the MongoDB PHP package already being pretty awesome. That's why in a lot of cases Monga is just a simple wrapper around the MongoDB classes. It provides some helpers and helps you set up queries using a query builder. Which you can also choose not to use! Everything will still work accordingly. During the development, a lot of planning has gone into creating a nice streamlined API that closely follows the MongoDB base classes, while complementing existing query builders for SQL-like databases.
Via Composer
$ composer require league/monga…A big part of the newly released MongoDB pecl package is aggregation support. Which is super easy to do with Monga:
$collection->aggregate(function ($a) {
$a->project([
'name' => 1,
'surname' => -1,
'tags' => 1,
])->unwind('tags');
// But also more advanced groups/projections
$a->project(function ($p) {
$p->select('field')
->select('scores')
->exclude('other_field');
})->group(function ($g) {
$g->by(['$name', '$surname'])
->sum('scores');
});
});Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
No open issues yet, or sync has not completed.