PHPackages                             dmitrymomot/mongodb-querybuilder - 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. dmitrymomot/mongodb-querybuilder

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

dmitrymomot/mongodb-querybuilder
================================

A query builder for mongodb

0.1.2(8y ago)03MITPHPPHP ^7.0

Since Jan 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dmitrymomot/mongodb-querybuilder)[ Packagist](https://packagist.org/packages/dmitrymomot/mongodb-querybuilder)[ RSS](/packages/dmitrymomot-mongodb-querybuilder/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

mongodb-querybuilder
====================

[](#mongodb-querybuilder)

A query builder for mongodb

[![PHP Version](https://camo.githubusercontent.com/17755f71eb6e0d0333a12377049dd4c484bbc503e7b4d7daac876b2b173aac58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545372e302d626c75652e737667)](https://img.shields.io/badge/PHP-%5E7.0-blue.svg)[![MongoDB Version](https://camo.githubusercontent.com/b8e6c4e1009dfcc534b6d3a7b56da09e74f3316a49ed594016e10b6c08a69ecf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6f6e676f44422d253545332e302d626c75652e737667)](https://img.shields.io/badge/MongoDB-%5E3.0-blue.svg)[![Build Status](https://camo.githubusercontent.com/630c615e571da80f07d44759887ef71c1b16cb3f238c20577aec090de1050056/68747470733a2f2f7472617669732d63692e6f72672f416c67617475782f6d6f6e676f64622d71756572796275696c6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Algatux/mongodb-querybuilder)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/11d25f9c21bcd692d8582a855dfed4b22210eaa2373158c5119011c893abd6e3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416c67617475782f6d6f6e676f64622d71756572796275696c6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Algatux/mongodb-querybuilder/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/35597bd6e6489297bb659026e696eef9d57b3bf88874b64cb33032cb2f6b4035/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f416c67617475782f6d6f6e676f64622d71756572796275696c6465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Algatux/mongodb-querybuilder/?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/452652fa7c0d4e9f25f35d7af3cd06c814894f0d5296e0483a72c661c678e697/68747470733a2f2f706f7365722e707567782e6f72672f616c67617475782f6d6f6e676f64622d71756572796275696c6465722f762f737461626c65)](https://packagist.org/packages/algatux/mongodb-querybuilder)[![Total Downloads](https://camo.githubusercontent.com/a05994faf6c83beec712079bcea9bf5fcf1ccda9b5118cef1ae7b541db962adf/68747470733a2f2f706f7365722e707567782e6f72672f616c67617475782f6d6f6e676f64622d71756572796275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/algatux/mongodb-querybuilder)[![Latest Unstable Version](https://camo.githubusercontent.com/27d3112e561b599ef39aa2dbcf5f9a6cd106643685a5ed28a5f274ed3f426b2c/68747470733a2f2f706f7365722e707567782e6f72672f616c67617475782f6d6f6e676f64622d71756572796275696c6465722f762f756e737461626c65)](https://packagist.org/packages/algatux/mongodb-querybuilder)[![License](https://camo.githubusercontent.com/38f63a76d85da0882a33609d80e8452bd4780ce6b5be066bcd0da07fb4e9ead3/68747470733a2f2f706f7365722e707567782e6f72672f616c67617475782f6d6f6e676f64622d71756572796275696c6465722f6c6963656e7365)](https://packagist.org/packages/algatux/mongodb-querybuilder)

Installation
------------

[](#installation)

require this library through composer:

```
composer require algatux/mongodb-querybuilder:dev-master
```

\##Usage example

```
/** @var \MongoDB\Collection $mongodbCollection */
$builder = new QueryBuilder($mongodbCollection);

/** @var \MongoDB\Driver\Cursor $cursor */
$cursor = $builder
    ->select('_id', 'field1') // projection
    ->and(
        $builder->expr()->or( // $or
            ['field1' => 'value1'],
            ['field2' => 'value2'],
        ),
        ['field3' => 'value3']
    ) // $and
    ->sort(['field1' => -1]) // sort option
    ->limit(10) // limit option
    ->skip(2) // skip option
    ->setQueryOption('foo', $bar) // adds not actually method supported options
    ->find() // will trigger $collection->find() method
    ->getQuery()
    ->execute();
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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 ~106 days

Total

3

Last Release

3253d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc65d100707fbcb8bd589b361245b702ade74480ccfd2a963b1f1672484f2e28?d=identicon)[dmitrymomot](/maintainers/dmitrymomot)

---

Top Contributors

[![Algatux](https://avatars.githubusercontent.com/u/888864?v=4)](https://github.com/Algatux "Algatux (26 commits)")[![dmitrymomot](https://avatars.githubusercontent.com/u/2080279?v=4)](https://github.com/dmitrymomot "dmitrymomot (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmitrymomot-mongodb-querybuilder/health.svg)

```
[![Health](https://phpackages.com/badges/dmitrymomot-mongodb-querybuilder/health.svg)](https://phpackages.com/packages/dmitrymomot-mongodb-querybuilder)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.0M88](/packages/mongodb-laravel-mongodb)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k24.1M345](/packages/doctrine-mongodb-odm)[alcaeus/mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-library

46312.5M74](/packages/alcaeus-mongo-php-adapter)[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

11135.2k6](/packages/leroy-merlin-br-mongolid)[doesntmattr/mongodb-migrations

Managed Database Migrations for MongoDB

23608.7k1](/packages/doesntmattr-mongodb-migrations)[facile-it/mongodb-bundle

Bundle service integration of official \[mongodb/mongo-php-library\](https://github.com/mongodb/mongo-php-library) driver library

37225.8k1](/packages/facile-it-mongodb-bundle)

PHPackages © 2026

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