PHPackages                             khaleelrasakh/laravel-datatables-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. khaleelrasakh/laravel-datatables-mongodb

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

khaleelrasakh/laravel-datatables-mongodb
========================================

Laravel DataTables plugin to support Mongodb

v1.0.4(9mo ago)0127MITPHP

Since Jul 27Pushed 9mo agoCompare

[ Source](https://github.com/khaleelrasakh/laravel-datatables-mongodb)[ Packagist](https://packagist.org/packages/khaleelrasakh/laravel-datatables-mongodb)[ RSS](/packages/khaleelrasakh-laravel-datatables-mongodb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Laravel DataTables Mongodb Plugin
=================================

[](#laravel-datatables-mongodb-plugin)

[![Latest Stable Version](https://camo.githubusercontent.com/3ec77bff53a80b2718e0900f0bb410c8ef5f9d356a3e7c45e49e70b1ff85ea38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70696d6c69652f6c61726176656c2d646174617461626c65732d6d6f6e676f64622e737667)](https://packagist.org/packages/pimlie/laravel-datatables-mongodb)[![Total Downloads](https://camo.githubusercontent.com/de6f962b293270c6771cc302023f7ef0ae103c82d765c7b37c727f51bc659aaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70696d6c69652f6c61726176656c2d646174617461626c65732d6d6f6e676f64622e737667)](https://packagist.org/packages/pimlie/laravel-datatables-mongodb)[![License](https://camo.githubusercontent.com/32c2363a02732d270d67f576e89cfb509a82cec1d3dcd29822c8246b79d2d7ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70696d6c69652f6c61726176656c2d646174617461626c65732d6d6f6e676f64622e737667)](https://packagist.org/packages/pimlie/laravel-datatables-mongodb)

This package is a plugin for [Laravel DataTables](https://github.com/yajra/laravel-datatables) to support Mongodb using [Laravel Mongodb](https://github.com/jenssegers/laravel-mongodb/)

Requirements
------------

[](#requirements)

- [Laravel DataTables &gt;=8.3](https://github.com/yajra/laravel-datatables)
- [Laravel Mongodb](https://github.com/jenssegers/laravel-mongodb)

Documentation
-------------

[](#documentation)

- [Laravel DataTables Documentation](http://yajrabox.com/docs/laravel-datatables)

This plugin provides most functionalities described in the Laravel Datatables documentation. See `Known issues` below

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

[](#installation)

`composer require pimlie/laravel-datatables-mongodb:^1.1`

Configure
---------

[](#configure)

Check the Laravel DataTables configuration for how to configure and use it.

If you want the `datables()` and/or `of` methods to automatically use the correct datatables engine,

Unfortunately we cant use auto-discovery yet, this package will be discoverd before laravel-datatables is and that will overwrite the engines config at the moment

&gt; Although this package has a dependency on laravel-datatables, you need to explictly require the package as auto-discovery works based on the packages listed in the dependencies section of your composer.json.

```
composer require yajra/laravel-datatables-oracle:"~8.0"
composer require pimlie/laravel-datatables-mongodb:^1.1

```

so you **either** you have to add the service provide:

```
'providers' => [
    ...,
    Yajra\DataTables\DataTablesServiceProvider::class,
    Pimlie\DataTables\MongodbDataTablesServiceProvider::class, // add _after_ Yajra's ServiceProvider
]

```

**or** open the `config/datatables.php` file and add the engines manually to the config:

```
    /**
     * Datatables list of available engines.
     * This is where you can register your custom datatables engine.
     */
    'engines'        => [
        // The Jenssegers\Mongodb classes extend the default Query/Eloquent classes
        // thus the engines need to be listed above the default engines
        // to make sure they are tried first
        'moloquent'      => Pimlie\DataTables\MongodbDataTable::class,
        'mongodb-query'  => Pimlie\DataTables\MongodbQueryDataTable::class,
        'mongodb-hybrid' => Pimlie\DataTables\HybridMongodbQueryDataTable::class,

        'eloquent'       => Yajra\DataTables\EloquentDataTable::class,
        'query-builder'  => Yajra\DataTables\QueryDataTable::class,
        'collection'     => Yajra\DataTables\CollectionDataTable::class,
    ],

    /**
     * Datatables accepted builder to engine mapping.
     * This is where you can override which engine a builder should use
     * Note, only change this if you know what you are doing!
     */
    'builders'       => [
        //MongoDB\Laravel\Eloquent\Builder::class             => 'moloquent',
        //MongoDB\Laravel\Query\Builder::class                => 'mongodb-query',
        //MongoDB\Laravel\Helpers\EloquentBuilder::class      => 'eloquent',
        //Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
        //Illuminate\Database\Eloquent\Builder::class            => 'eloquent',
        //Illuminate\Database\Query\Builder::class               => 'query',
        //Illuminate\Support\Collection::class                   => 'collection',
    ],
```

Usage
-----

[](#usage)

### Use the `datatables()` method

[](#use-the-datatables-method)

For this to work you need to have the class definitions added to the `engines` and `builders` datatables configuration, see above.

```
use \App\MyMongodbModel;

$datatables = datatables(MyMongodbModel::all());
```

### Use the dataTable class directly.

[](#use-the-datatable-class-directly)

```
use Pimlie\DataTables\MongodbDataTable;

return (new MongodbDataTable(App\User::where('id', '>', 1))->toJson()
```

### Use via trait.

[](#use-via-trait)

- Add the `MongodbDataTableTrait` trait to your model.

```
use MongoDB\Laravel\Eloquent\Model;
use Pimlie\DataTables\Traits\MongodbDataTableTrait;

class User extends Model
{
	use MongodbDataTableTrait;
}
```

- Call dataTable() directly on your model.

```
Route::get('users/data', function() {
	return User::dataTable()->toJson();
});
```

Known issues
------------

[](#known-issues)

- the `orderColumn` and `orderColumns` methods are empty placeholders and do nothing
- there is currently no support for viewing/searching/ordering on (non-embedded) relationships between Models (eg through a `user.posts` column key)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance57

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.1% 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 ~1 days

Total

5

Last Release

285d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34b567bb090c4252149b2038d7b15591c30cb81fb81480788a97be93b12eb8fb?d=identicon)[khaleelrasakh](/maintainers/khaleelrasakh)

---

Top Contributors

[![pimlie](https://avatars.githubusercontent.com/u/1067403?v=4)](https://github.com/pimlie "pimlie (23 commits)")[![khaleelrasakh](https://avatars.githubusercontent.com/u/186787981?v=4)](https://github.com/khaleelrasakh "khaleelrasakh (16 commits)")[![khaleelcloudme](https://avatars.githubusercontent.com/u/103485618?v=4)](https://github.com/khaleelcloudme "khaleelcloudme (4 commits)")[![alfa6661](https://avatars.githubusercontent.com/u/3650559?v=4)](https://github.com/alfa6661 "alfa6661 (1 commits)")[![prakasharulmani123](https://avatars.githubusercontent.com/u/9291644?v=4)](https://github.com/prakasharulmani123 "prakasharulmani123 (1 commits)")

---

Tags

laraveldatatablesmongodb

### Embed Badge

![Health badge](/badges/khaleelrasakh-laravel-datatables-mongodb/health.svg)

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

###  Alternatives

[omines/datatables-bundle

Symfony DataTables Bundle with native Doctrine ORM, Elastica and MongoDB support

2851.4M6](/packages/omines-datatables-bundle)[pimlie/laravel-datatables-mongodb

Laravel DataTables plugin to support Mongodb

1245.9k](/packages/pimlie-laravel-datatables-mongodb)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)

PHPackages © 2026

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