PHPackages                             phalcon/incubator-mongodb - 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. [Framework](/categories/framework)
4. /
5. phalcon/incubator-mongodb

ActiveLibrary[Framework](/categories/framework)

phalcon/incubator-mongodb
=========================

Phalcon Incubator MongoDB

v2.0.1(2y ago)624.5k↓35.2%8BSD-3-ClausePHPPHP &gt;=7.4CI failing

Since Dec 19Pushed 3mo ago5 watchersCompare

[ Source](https://github.com/phalcon/incubator-mongodb)[ Packagist](https://packagist.org/packages/phalcon/incubator-mongodb)[ Docs](https://phalcon.io)[ GitHub Sponsors](https://github.com/phalcon)[ Fund](https://opencollective.com/phalcon)[ RSS](/packages/phalcon-incubator-mongodb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (6)Used By (0)

Phalcon\\Incubator\\MongoDB
===========================

[](#phalconincubatormongodb)

[![Discord](https://camo.githubusercontent.com/28c6fc95b5decf0e67719a5438501589c00b2db2b15228e67479d6548bbc9f6b/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3331303931303438383135323337353239373f6c6162656c3d446973636f7264)](http://phalcon.io/discord)[![Packagist Version](https://camo.githubusercontent.com/df584317116fb3aaab53f2b123774a0b20a7e7dac079669a2416053da7f29bee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068616c636f6e2f696e63756261746f722d6d6f6e676f6462)](https://packagist.org/packages/phalcon/incubator-mongodb)[![PHP from Packagist](https://camo.githubusercontent.com/3525569f4ab06e237de1075551cf2393bf7ecff04b5795896c8c0dfa8f0dc235/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068616c636f6e2f696e63756261746f722d6d6f6e676f6462)](https://packagist.org/packages/phalcon/incubator-mongodb)[![codecov](https://camo.githubusercontent.com/ee15125de26477f620e9284125b09bcee2c19d99bd3e7c1426b7178fd63cebf1/68747470733a2f2f636f6465636f762e696f2f67682f7068616c636f6e2f696e63756261746f722d6d6f6e676f64622f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/phalcon/incubator-mongodb)[![Packagist](https://camo.githubusercontent.com/eed042f3b0f6357b4d9ba8e36203f75f339fa92daf7c80247ab1607e6e8f6e29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f7068616c636f6e2f696e63756261746f722d6d6f6e676f6462)](https://packagist.org/packages/phalcon/incubator-mongodb/stats)

Issues tracker
--------------

[](#issues-tracker)

What is it
----------

[](#what-is-it)

Set of helpers - simplifying working with mongodb via AR paradigm.

Helper
------

[](#helper)

`Phalcon\Incubator\MongoDB\Helper`

MethodDescription`Helper::isValidObjectId($id)`Checks if id parameter is a valid ObjectID`Helper::convertDatetime($datetime)`Converts a DateTime object to UTCDateTime from MongoDBCollection Manager
------------------

[](#collection-manager)

Manager controls the initialization of collections, keeping record of relations between the different collections of the application.

```
use Phalcon\Incubator\MongoDB\Mvc\Collection\Manager;

$di->set(
    'collectionsManager',
    function () {
        return new Manager();
    }
);
```

Collection
----------

[](#collection)

ActiveRecord class for the management of MongoDB collections.

### Defining collection

[](#defining-collection)

```
use Phalcon\Incubator\MongoDB\Mvc\Collection;

class RobotsCollection extends Collection
{
    public $code;

    public $theName;

    public $theType;

    public $theYear;
}

$robots = new RobotsCollection($data);
```

### Search examples

[](#search-examples)

```
use MongoDB\BSON\ObjectId;

// How many robots are there?
$robots = RobotsCollection::find();

echo "There are ", count($robots), "\n";

// How many mechanical robots are there?
$robots = RobotsCollection::find([
    [
        "type" => "mechanical",
    ],
]);

echo "There are ", count(robots), "\n";

// Get and print virtual robots ordered by name
$robots = RobotsCollection::findFirst([
    [
        "type" => "virtual",
    ],
    "order" => [
        "name" => 1,
    ],
]);

foreach ($robots as $robot) {
    echo $robot->name, "\n";
}

// Get first 100 virtual robots ordered by name
$robots = RobotsCollection::find([
    [
        "type" => "virtual",
    ],
    "order" => [
        "name" => 1,
    ],
    "limit" => 100,
]);

foreach (RobotsCollection as $robot) {
    echo $robot->name, "\n";
}

$robot = RobotsCollection::findFirst([
    [
        "_id" => new ObjectId("45cbc4a0e4123f6920000002"),
    ],
]);

// Find robot by using \MongoDB\BSON\ObjectId object
$robot = RobotsCollection::findById(
    new ObjectId("545eb081631d16153a293a66")
);

// Find robot by using id as sting
$robot = RobotsCollection::findById("45cbc4a0e4123f6920000002");

// Validate input
if ($robot = RobotsCollection::findById($_POST["id"])) {
    // ...
}
```

### Adding behavior

[](#adding-behavior)

```
use Phalcon\Incubator\MongoDB\Mvc\Collection;
use Phalcon\Incubator\MongoDB\Mvc\Collection\Behavior\Timestampable;

class RobotsCollection extends Collection
{
    public $code;

    public $theName;

    public $theType;

    public $theYear;

    protected function onConstruct()
    {
         $this->addBehavior(
             new Timestampable(
                 [
                     "beforeCreate" => [
                         "field"  => "created_at",
                         "format" => "Y-m-d",
                     ],
                 ]
             )
         );
    }
}
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance53

Moderate activity, may be stable

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.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 ~368 days

Total

4

Last Release

870d ago

Major Versions

v1.0.1 → v2.0.02023-07-09

PHP version history (2 changes)v1.0.0PHP &gt;=7.2

v2.0.0PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![Jeckerson](https://avatars.githubusercontent.com/u/3289702?v=4)](https://github.com/Jeckerson "Jeckerson (68 commits)")[![tacxou](https://avatars.githubusercontent.com/u/12997062?v=4)](https://github.com/tacxou "tacxou (49 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![ruudboon](https://avatars.githubusercontent.com/u/7444246?v=4)](https://github.com/ruudboon "ruudboon (1 commits)")[![super-dm3](https://avatars.githubusercontent.com/u/5605919?v=4)](https://github.com/super-dm3 "super-dm3 (1 commits)")

---

Tags

mongodbmongodb-drivermongodb-ormframeworkmongodbphalconincubator

###  Code Quality

TestsCodeception

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phalcon-incubator-mongodb/health.svg)

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

###  Alternatives

[phalcon/incubator

Adapters, prototypes or functionality that can be potentially incorporated to the C-framework.

7222.9M81](/packages/phalcon-incubator)[phalcon/devtools

This tools provide you useful scripts to generate code helping to develop faster and easy applications that use with Phalcon framework.

1.3k2.0M54](/packages/phalcon-devtools)[atk4/data

Agile Data - Database access abstraction framework

2811.7M37](/packages/atk4-data)[phalcon/migrations

Run and Generate DB Migrations with Phalcon Framework

29977.8k6](/packages/phalcon-migrations)[phalcon/incubator-mailer

Phalcon Incubator Mailer Adapters

1318.1k2](/packages/phalcon-incubator-mailer)

PHPackages © 2026

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