PHPackages                             sirakoff/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. [Database &amp; ORM](/categories/database)
4. /
5. sirakoff/mongodb

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

sirakoff/mongodb
================

A MongoDB based Eloquent model and Query builder for Laravel 4

v2.0.2(11y ago)112MITPHPPHP &gt;=5.4.0

Since Aug 18Pushed 11y ago1 watchersCompare

[ Source](https://github.com/sirakov/mongodb)[ Packagist](https://packagist.org/packages/sirakoff/mongodb)[ RSS](/packages/sirakoff-mongodb/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (39)Used By (0)

Laravel MongoDB
===============

[](#laravel-mongodb)

[![Latest Stable Version](https://camo.githubusercontent.com/400db45783413d69c47a9275afc1d452211b300b3904b2588b7c5af8cc921ded/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6a656e737365676572732f6c61726176656c2d6d6f6e676f64622e737667)](https://packagist.org/packages/jenssegers/mongodb) [![Total Downloads](https://camo.githubusercontent.com/2c44c93d1eb57bf9dd7ed049d96dc4bb2a7c1a0efbdd01afc3113581ebe20754/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6a656e737365676572732f6d6f6e676f64622e737667)](https://packagist.org/packages/jenssegers/mongodb) [![Build Status](https://camo.githubusercontent.com/45a32e8c7934e1c6b29daa6497b55837d188407415e4508daf7a93750cfcc837/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6a656e737365676572732f6c61726176656c2d6d6f6e676f64622e737667)](https://travis-ci.org/jenssegers/laravel-mongodb) [![Coverage Status](https://camo.githubusercontent.com/be7f09f7f3609fdcc3e11ec5ab08ac589e4d78288b0572e753adfac7fc81b9a7/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a656e737365676572732f6c61726176656c2d6d6f6e676f64622e737667)](https://coveralls.io/r/jenssegers/laravel-mongodb?branch=master)

An Eloquent model and Query builder with support for MongoDB, using the original Laravel API. *This library extends the original Laravel classes, so it uses exactly the same methods.*

### Upgrading from v1 to v2

[](#upgrading-from-v1-to-v2)

In this new version, embedded documents are no longer saved to the parent model using an attribute with a leading underscore. If you have a relation like `embedsMany('Book')`, these books are now stored under `$model['books']` instead of `$model['_books']`. This was changed to make embedded relations less confusing for new developers.

If you want to upgrade to this new version without having to change all your existing database objects, you can modify your embedded relations to use a non-default local key including the underscore:

```
$this->embedsMany('Book', '_books');

```

Read the full changelog at

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

[](#installation)

Make sure you have the MongoDB PHP driver installed. You can find installation instructions at

Add the package to your `composer.json` and run `composer update`.

```
{
    "require": {
        "jenssegers/mongodb": "*"
    }
}

```

Add the service provider in `app/config/app.php`:

```
'Jenssegers\Mongodb\MongodbServiceProvider',

```

The service provider will register a mongodb database extension with the original database manager. There is no need to register additional facades or objects. When using mongodb connections, Laravel will automatically provide you with the corresponding mongodb objects.

Configuration
-------------

[](#configuration)

Change your default database connection name in `app/config/database.php`:

```
'default' => 'mongodb',

```

And add a new mongodb connection:

```
'mongodb' => array(
    'driver'   => 'mongodb',
    'host'     => 'localhost',
    'port'     => 27017,
    'username' => 'username',
    'password' => 'password',
    'database' => 'database'
),

```

You can connect to multiple servers or replica sets with the following configuration:

```
'mongodb' => array(
    'driver'   => 'mongodb',
    'host'     => array('server1', 'server2'),
    'port'     => 27017,
    'username' => 'username',
    'password' => 'password',
    'database' => 'database',
    'options'  => array('replicaSet' => 'replicaSetName')
),

```

Eloquent
--------

[](#eloquent)

This package includes a MongoDB enabled Eloquent class that you can use to define models for corresponding collections.

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {}

```

Note that we did not tell Eloquent which collection to use for the `User` model. Just like the original Eloquent, the lower-case, plural name of the class will be used as the table name unless another name is explicitly specified. You may specify a custom collection (alias for table) by defining a `collection` property on your model:

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    protected $collection = 'users_collection';

}

```

**NOTE:** Eloquent will also assume that each collection has a primary key column named id. You may define a `primaryKey` property to override this convention. Likewise, you may define a `connection` property to override the name of the database connection that should be used when utilizing the model.

```
use Jenssegers\Mongodb\Model as Eloquent;

class MyModel extends Eloquent {

    protected $connection = 'mongodb';

}

```

Everything else works just like the original Eloquent model. Read more about the Eloquent on

### Optional: Alias

[](#optional-alias)

You may also register an alias for the MongoDB model by adding the following to the alias array in `app/config/app.php`:

```
'Moloquent'       => 'Jenssegers\Mongodb\Model',

```

This will allow you to use the registered alias like:

```
class MyModel extends Moloquent {}

```

Query Builder
-------------

[](#query-builder)

The database driver plugs right into the original query builder. When using mongodb connections, you will be able to build fluent queries to perform database operations. For your convenience, there is a `collection` alias for `table` as well as some additional mongodb specific operators/operations.

```
$users = DB::collection('users')->get();

$user = DB::collection('users')->where('name', 'John')->first();

```

If you did not change your default database connection, you will need to specify it when querying.

```
$user = DB::connection('mongodb')->collection('users')->get();

```

Read more about the query builder on

Schema
------

[](#schema)

The database driver also has (limited) schema builder support. You can easily manipulate collections and set indexes:

```
Schema::create('users', function($collection)
{
    $collection->index('name');

    $collection->unique('email');
});

```

Supported operations are:

- create and drop
- collection
- hasCollection
- index and dropIndex (compound indexes supported as well)
- unique
- background, sparse, expire (MongoDB specific)

All other (unsupported) operations are implemented as dummy pass-through methods, because MongoDB does not use a predefined schema. Read more about the schema builder on

Extensions
----------

[](#extensions)

### Auth

[](#auth)

If you want to use Laravel's native Auth functionality, register this included service provider:

```
'Jenssegers\Mongodb\Auth\ReminderServiceProvider',

```

This service provider will slightly modify the internal DatabaseReminderRepository to add support for MongoDB based password reminders. If you don't use password reminders, you don't have to register this service provider and everything else should work just fine.

### Sentry

[](#sentry)

If yo want to use this library with [Sentry](https://cartalyst.com/manual/sentry), then check out

### Sessions

[](#sessions)

The MongoDB session driver is available in a separate package, check out

Troubleshooting
---------------

[](#troubleshooting)

#### Class 'MongoClient' not found in ...

[](#class-mongoclient-not-found-in-)

The `MongoClient` class is part of the MongoDB PHP driver. Usually, this error means that you forgot to install, or did not install this driver correctly. You can find installation instructions for this driver at .

To check if you have installed the driver correctly, run the following command:

```
$ php -i | grep 'Mongo'
MongoDB Support => enabled

```

#### Argument 2 passed to Illuminate\\Database\\Query\\Builder::\_\_construct() must be an instance of Illuminate\\Database\\Query\\Grammars\\Grammar, null given

[](#argument-2-passed-to-illuminatedatabasequerybuilder__construct-must-be-an-instance-of-illuminatedatabasequerygrammarsgrammar-null-given)

To solve this, you will need to check two things. First check if your model is extending the correct class; this class should be `Jenssegers\Mongodb\Model`. Secondly, check if your model is using a MongoDB connection. If you did not change the default database connection in your database configuration file, you need to specify the MongoDB enabled connection. This is what your class should look like if you did not set up an alias and change the default database connection:

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    protected $connection = 'mongodb';

}

```

Examples
--------

[](#examples)

### Basic Usage

[](#basic-usage)

**Retrieving All Models**

```
$users = User::all();

```

**Retrieving A Record By Primary Key**

```
$user = User::find('517c43667db388101e00000f');

```

**Wheres**

```
$users = User::where('votes', '>', 100)->take(10)->get();

```

**Or Statements**

```
$users = User::where('votes', '>', 100)->orWhere('name', 'John')->get();

```

**And Statements**

```
$users = User::where('votes', '>', 100)->where('name', '=', 'John')->get();

```

**Using Where In With An Array**

```
$users = User::whereIn('age', array(16, 18, 20))->get();

```

When using `whereNotIn` objects will be returned if the field is non existent. Combine with `whereNotNull('age')` to leave out those documents.

**Using Where Between**

```
$users = User::whereBetween('votes', array(1, 100))->get();

```

**Where null**

```
$users = User::whereNull('updated_at')->get();

```

**Order By**

```
$users = User::orderBy('name', 'desc')->get();

```

**Offset &amp; Limit**

```
$users = User::skip(10)->take(5)->get();

```

**Distinct**

Distinct requires a field for which to return the distinct values.

```
$users = User::distinct()->get(array('name'));
// or
$users = User::distinct('name')->get();

```

Distinct can be combined with **where**:

```
$users = User::where('active', true)->distinct('name')->get();

```

**Advanced Wheres**

```
$users = User::where('name', '=', 'John')->orWhere(function($query)
    {
        $query->where('votes', '>', 100)
              ->where('title', '', 'Admin');
    })
    ->get();

```

**Group By**

Selected columns that are not grouped will be aggregated with the $last function.

```
$users = Users::groupBy('title')->get(array('title', 'name'));

```

**Aggregation**

*Aggregations are only available for MongoDB versions greater than 2.2.*

```
$total = Order::count();
$price = Order::max('price');
$price = Order::min('price');
$price = Order::avg('price');
$total = Order::sum('price');

```

Aggregations can be combined with **where**:

```
$sold = Orders::where('sold', true)->sum('price');

```

**Like**

```
$user = Comment::where('body', 'like', '%spam%')->get();

```

**Incrementing or decrementing a value of a column**

Perform increments or decrements (default 1) on specified attributes:

```
User::where('name', 'John Doe')->increment('age');
User::where('name', 'Jaques')->decrement('weight', 50);

```

The number of updated objects is returned:

```
$count = User->increment('age');

```

You may also specify additional columns to update:

```
User::where('age', '29')->increment('age', 1, array('group' => 'thirty something'));
User::where('bmi', 30)->decrement('bmi', 1, array('category' => 'overweight'));

```

**Soft deleting**

When soft deleting a model, it is not actually removed from your database. Instead, a deleted\_at timestamp is set on the record. To enable soft deletes for a model, apply the SoftDeletingTrait to the model:

```
use Jenssegers\Mongodb\Eloquent\SoftDeletingTrait;

class User extends Eloquent {

    use SoftDeletingTrait;

    protected $dates = ['deleted_at'];

}

```

For more information check

### MongoDB specific operators

[](#mongodb-specific-operators)

**Exists**

Matches documents that have the specified field.

```
User::where('age', 'exists', true)->get();

```

**All**

Matches arrays that contain all elements specified in the query.

```
User::where('roles', 'all', array('moderator', 'author'))->get();

```

**Size**

Selects documents if the array field is a specified size.

```
User::where('tags', 'size', 3)->get();

```

**Regex**

Selects documents where values match a specified regular expression.

```
User::where('name', 'regex', new MongoRegex("/.*doe/i"))->get();

```

**NOTE:** you can also use the Laravel regexp operations. These are a bit more flexible and will automatically convert your regular expression string to a MongoRegex object.

```
User::where('name', 'regexp', '/.*doe/i'))->get();

```

And the inverse:

```
User::where('name', 'not regexp', '/.*doe/i'))->get();

```

**Type**

Selects documents if a field is of the specified type. For more information check: [http://docs.mongodb.org/manual/reference/operator/query/type/#op.\_S\_type](http://docs.mongodb.org/manual/reference/operator/query/type/#op._S_type)

```
User::where('age', 'type', 2)->get();

```

**Mod**

Performs a modulo operation on the value of a field and selects documents with a specified result.

```
User::where('age', 'mod', array(10, 0))->get();

```

**Where**

Matches documents that satisfy a JavaScript expression. For more information check [http://docs.mongodb.org/manual/reference/operator/query/where/#op.\_S\_where](http://docs.mongodb.org/manual/reference/operator/query/where/#op._S_where)

### Inserts, updates and deletes

[](#inserts-updates-and-deletes)

Inserting, updating and deleting records works just like the original Eloquent.

**Saving a new model**

```
$user = new User;
$user->name = 'John';
$user->save();

```

You may also use the create method to save a new model in a single line:

```
User::create(array('name' => 'John'));

```

**Updating a model**

o update a model, you may retrieve it, change an attribute, and use the save method.

```
$user = User::first();
$user->email = 'john@foo.com';
$user->save();

```

*There is also support for upsert operations, check *

**Deleting a model**

To delete a model, simply call the delete method on the instance:

```
$user = User::first();
$user->delete();

```

Or deleting a model by its key:

```
User::destroy('517c43667db388101e00000f');

```

For more information about model manipulation, check

### Dates

[](#dates)

Eloquent allows you to work with Carbon/DateTime objects instead of MongoDate objects. Internally, these dates will be converted to MongoDate objects when saved to the database. If you wish to use this functionality on non-default date fields you will need to manually specify them as described here:

Example:

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    protected $dates = array('birthday');

}

```

Which allows you to execute queries like:

```
$users = User::where('birthday', '>', new DateTime('-18 years'))->get();

```

### Relations

[](#relations)

Supported relations are:

- hasOne
- hasMany
- belongsTo
- belongsToMany

Example:

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    public function items()
    {
        return $this->hasMany('Item');
    }

}

```

And the inverse relation:

```
use Jenssegers\Mongodb\Model as Eloquent;

class Item extends Eloquent {

    public function user()
    {
        return $this->belongsTo('User');
    }

}

```

The belongsToMany relation will not use a pivot "table", but will push id's to a **related\_ids** attribute instead. This makes the second parameter for the belongsToMany method useless. If you want to define custom keys for your relation, set it to `null`:

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    public function groups()
    {
        return $this->belongsToMany('Group', null, 'users', 'groups');
    }

}

```

Other relations are not yet supported, but may be added in the future. Read more about these relations on

### EmbedsMany Relations

[](#embedsmany-relations)

If you want to embed models, rather than referencing them, you can use the `embedsMany` relation. This relation is similar to the `hasMany` relation, but embeds the models inside the parent object.

```
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent {

    public function books()
    {
        return $this->embedsMany('Book');
    }

}

```

You access the embedded models through the dynamic property:

```
$books = User::first()->books;

```

The inverse relation is auto*magically* available, you don't need to define this reverse relation.

```
$user = $book->user;

```

Inserting and updating embedded models works similar to the `hasMany` relation:

```
$book = new Book(array('title' => 'A Game of Thrones'));

$user = User::first();

$book = $user->books()->save($book);
// or
$book = $user->books()->create(array('title' => 'A Game of Thrones'))

```

You can update embedded models using their `save` method (available since release 2.0.0):

```
$book = $user->books()->first();

$book->title = 'A Game of Thrones';

$book->save();

```

You can remove an embedded model by using the `destroy` method on the relation, or the `delete` method on the model (available since release 2.0.0):

```
$book = $user->books()->first();

$book->delete();
// or
$user->books()->destroy($book);

```

If you want to add or remove an embedded model, without touching the database, you can use the `associate` and `dissociate` methods. To eventually write the changes to the database, save the parent object:

```
$user->books()->associate($book);

$user->save();

```

Like other relations, embedsMany assumes the local key of the relationship based on the model name. You can override the default local key by passing a second argument to the embedsMany method:

```
return $this->embedsMany('Book', 'local_key');

```

Embedded relations will return a Collection of embedded items instead of a query builder. To allow a more query-like behavior, a modified version of the Collection class is used, with support for the following **additional** operations:

- where($key, $operator, $value)
- whereIn($key, $values) and whereNotIn($key, $values)
- whereBetween($key, $values) and whereNotBetween($key, $values)
- whereNull($key) and whereNotNull($key)
- orderBy($key, $direction)
- oldest() and latest()
- limit($value)
- offset($value)
- skip($value)

This allows you to execute simple queries on the collection results:

```
$books = $user->books()->where('rating', '>', 5)->orderBy('title')->get();

```

**Note:** Because embedded models are not stored in a separate collection, you can not query all of embedded models. You will always have to access them through the parent model.

### EmbedsOne Relations

[](#embedsone-relations)

The embedsOne relation is similar to the EmbedsMany relation, but only embeds a single model.

```
use Jenssegers\Mongodb\Model as Eloquent;

class Book extends Eloquent {

    public function author()
    {
        return $this->embedsOne('Author');
    }

}

```

You access the embedded models through the dynamic property:

```
$author = Book::first()->author;

```

Inserting and updating embedded models works similar to the `hasOne` relation:

```
$author = new Author(array('name' => 'John Doe'));

$book = Books::first();

$author = $book->author()->save($author);
// or
$author = $book->author()->create(array('name' => 'John Doe'));

```

You can update the embedded model using the `save` method (available since release 2.0.0):

```
$author = $book->author;

$author->name = 'Jane Doe';
$author->save();

```

You can replace the embedded model with a new model like this:

```
$newAuthor = new Author(array('name' => 'Jane Doe'));
$book->author()->save($newAuthor);

```

### MySQL Relations

[](#mysql-relations)

If you're using a hybrid MongoDB and SQL setup, you're in luck! The model will automatically return a MongoDB- or SQL-relation based on the type of the related model. Of course, if you want this functionality to work both ways, your SQL-models will need to extend `Jenssegers\Eloquent\Model`. Note that this functionality only works for hasOne, hasMany and belongsTo relations.

Example SQL-based User model:

```
use Jenssegers\Eloquent\Model as Eloquent;

class User extends Eloquent {

    protected $connection = 'mysql';

    public function messages()
    {
        return $this->hasMany('Message');
    }

}

```

And the Mongodb-based Message model:

```
use Jenssegers\Mongodb\Model as Eloquent;

class Message extends Eloquent {

    protected $connection = 'mongodb';

    public function user()
    {
        return $this->belongsTo('User');
    }

}

```

### Raw Expressions

[](#raw-expressions)

These expressions will be injected directly into the query.

```
User::whereRaw(array('age' => array('$gt' => 30, '$lt' => 40)))->get();

```

You can also perform raw expressions on the internal MongoCollection object. If this is executed on the model class, it will return a collection of models. If this is executed on the query builder, it will return the original response.

```
// Returns a collection of User models.
$models = User::raw(function($collection)
{
    return $collection->find();
});

// Returns the original MongoCursor.
$cursor = DB::collection('users')->raw(function($collection)
{
    return $collection->find();
});

```

Optional: if you don't pass a closure to the raw method, the internal MongoCollection object will be accessible:

```
$model = User::raw()->findOne(array('age' => array('$lt' => 18)));

```

The internal MongoClient and MongoDB objects can be accessed like this:

```
$client = DB::getMongoClient();
$db = DB::getMongoDB();

```

### MongoDB specific operations

[](#mongodb-specific-operations)

**Cursor timeout**

To prevent MongoCursorTimeout exceptions, you can manually set a timeout value that will be applied to the cursor:

```
DB::collection('users')->timeout(-1)->get();

```

**Upsert**

Update or insert a document. Additional options for the update method are passed directly to the native update method.

```
DB::collection('users')->where('name', 'John')
                       ->update($data, array('upsert' => true));

```

**Projections**

You can apply projections to your queries using the `project` method.

```
DB::collection('items')->project(array('tags' => array('$slice' => 1)))->get();

```

**Push**

Add an items to an array.

```
DB::collection('users')->where('name', 'John')->push('items', 'boots');
DB::collection('users')->where('name', 'John')->push('messages', array('from' => 'Jane Doe', 'message' => 'Hi John'));

```

If you don't want duplicate items, set the third parameter to `true`:

```
DB::collection('users')->where('name', 'John')->push('items', 'boots', true);

```

**Pull**

Remove an item from an array.

```
DB::collection('users')->where('name', 'John')->pull('items', 'boots');
DB::collection('users')->where('name', 'John')->pull('messages', array('from' => 'Jane Doe', 'message' => 'Hi John'));

```

**Unset**

Remove one or more fields from a document.

```
DB::collection('users')->where('name', 'John')->unset('note');

```

You can also perform an unset on a model.

```
$user = User::where('name', 'John')->first();
$user->unset('note');

```

### Query Caching

[](#query-caching)

You may easily cache the results of a query using the remember method:

```
$users = User::remember(10)->get();

```

*From: *

### Query Logging

[](#query-logging)

By default, Laravel keeps a log in memory of all queries that have been run for the current request. However, in some cases, such as when inserting a large number of rows, this can cause the application to use excess memory. To disable the log, you may use the `disableQueryLog` method:

```
DB::connection()->disableQueryLog();

```

*From: *

###  Health Score

31

—

LowBetter than 70% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~10 days

Total

37

Last Release

4207d ago

Major Versions

v1.1.2 → 4.0.x-dev2014-01-08

v1.4.0 → 4.1.x-dev2014-06-02

v1.4.2 → v2.0.0-alpha2014-08-06

v1.4.3 → v2.0.02014-08-10

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

v1.4.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/92a980d1c5cce17646d38bdb64984ef997bd3b6401e55ee8159e747b6b1b0c06?d=identicon)[sirakoff](/maintainers/sirakoff)

---

Top Contributors

[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (400 commits)")[![alexandre-butynski](https://avatars.githubusercontent.com/u/671662?v=4)](https://github.com/alexandre-butynski "alexandre-butynski (12 commits)")[![Daveawb](https://avatars.githubusercontent.com/u/4409005?v=4)](https://github.com/Daveawb "Daveawb (6 commits)")[![duxet](https://avatars.githubusercontent.com/u/821707?v=4)](https://github.com/duxet "duxet (5 commits)")[![v-six](https://avatars.githubusercontent.com/u/3017033?v=4)](https://github.com/v-six "v-six (4 commits)")[![khamkham](https://avatars.githubusercontent.com/u/5898200?v=4)](https://github.com/khamkham "khamkham (2 commits)")[![codeclown](https://avatars.githubusercontent.com/u/211543?v=4)](https://github.com/codeclown "codeclown (2 commits)")[![dgreda](https://avatars.githubusercontent.com/u/4435227?v=4)](https://github.com/dgreda "dgreda (2 commits)")[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (2 commits)")[![ricardoaponte](https://avatars.githubusercontent.com/u/406591?v=4)](https://github.com/ricardoaponte "ricardoaponte (2 commits)")[![sirakoff](https://avatars.githubusercontent.com/u/5459671?v=4)](https://github.com/sirakoff "sirakoff (2 commits)")[![oadtz](https://avatars.githubusercontent.com/u/4559838?v=4)](https://github.com/oadtz "oadtz (1 commits)")[![pies](https://avatars.githubusercontent.com/u/37940?v=4)](https://github.com/pies "pies (1 commits)")[![potsky](https://avatars.githubusercontent.com/u/408237?v=4)](https://github.com/potsky "potsky (1 commits)")[![vsouza](https://avatars.githubusercontent.com/u/484656?v=4)](https://github.com/vsouza "vsouza (1 commits)")[![shubhamoy](https://avatars.githubusercontent.com/u/106255?v=4)](https://github.com/shubhamoy "shubhamoy (1 commits)")[![wikichua](https://avatars.githubusercontent.com/u/1870466?v=4)](https://github.com/wikichua "wikichua (1 commits)")[![andrewryno](https://avatars.githubusercontent.com/u/50643?v=4)](https://github.com/andrewryno "andrewryno (1 commits)")[![Gabrola](https://avatars.githubusercontent.com/u/1728215?v=4)](https://github.com/Gabrola "Gabrola (1 commits)")[![franzliedke](https://avatars.githubusercontent.com/u/249125?v=4)](https://github.com/franzliedke "franzliedke (1 commits)")

---

Tags

laraveldatabasemodeleloquentmongodbmongo

### Embed Badge

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

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

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k6.8M60](/packages/mongodb-laravel-mongodb)

PHPackages © 2026

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