Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mongodb Lite

Mongodb Lite Laravel Package

jenssegers/mongodb-lite

Lightweight MongoDB integration for Laravel. Provides Eloquent-style models backed by MongoDB collections, letting you query, insert, and manage documents with familiar Laravel syntax while keeping dependencies and footprint small.

View on GitHub
Deep Wiki
Context7

MongoDB-Lite brings MongoDB support to Laravel's Eloquent ORM and query builder in a slimmed-down package. Define Eloquent models backed by MongoDB collections and keep using the familiar Laravel syntax for querying, saving, and deleting documents — without the bulk of the full integration.

  • Eloquent models and query builder for MongoDB collections
  • Familiar methods: where, first, get, save, delete
  • Relationships, accessors, and attribute casting support
  • Lightweight footprint with only the essentials included
Frequently asked questions about Mongodb Lite
How do I install jenssegers/mongodb-lite in a Laravel 4.2 application?
Run composer require jenssegers/mongodb-lite:~1.1, then manually register the package service provider and MongoDB facade alias in app/config/app.php, publish the config with php artisan config:publish, set your connection details, and run composer dump-autoload. Check the actual composer.lock diff afterwards, because on a 4.2-era dependency graph the solver can silently drag a shared illuminate/* component backwards even when the install reports success. Finish by proving one round-trip against a throwaway collection.
Does jenssegers/mongodb-lite work with Laravel 5 or newer?
No. Version 1.1 explicitly pins the framework to a ~4.2 constraint, so on Laravel 5+ it will either refuse to resolve or pull illuminate/* components backwards. It is explicitly not a bridge to newer Laravel releases. For 5.x and beyond, use the full jenssegers/laravel-mongodb package or another maintained driver.
How do I configure the MongoDB connection for mongodb-lite?
Publish the package configuration with php artisan config:publish and set the host, port, database, and credentials in the generated file. Also pin the MongoDB server version and PHP driver baseline in composer.json's platform block and document them against a host baseline. The legacy driver generation is sensitive to server-version mismatch, and mismatches tend to surface as failures on specific operations rather than at connect time.
How do I define an Eloquent model backed by a MongoDB collection?
Extend the package's base model class, point the model at its collection and connection, and then query and persist with familiar methods such as where, first, get, save, and delete. Because the package ships no schema registry, no migrations, and no repository layer, your application code must own validation, document shape enforcement, and referential consistency.
Does mongodb-lite support relationships, accessors, and attribute casting?
The package advertises relationships, accessors, and attribute casting, but 'Eloquent-style' is not Eloquent, so treat each behavior as unverified until you test it. Relations, eager loading, the save() lifecycle events, and casting may be absent or only partially implemented. Cover every Eloquent semantic your application actually depends on with a test before it becomes load-bearing.
Why is my _id returned as an object instead of a string?
MongoDB ObjectId values are not PHP strings, and the package passes them through as objects. That produces the predictable trio of JSON responses containing objects where clients expect strings, lookups failing on type mismatch, and ordering assumptions that treat _id as a timestamp. Cast or transform _id at your API boundary and always query with the correct ObjectId type.
Does mongodb-lite support transactions or atomic multi-document writes?
No. There is no transaction support and no multi-document atomicity in this layer. Write paths must be idempotent and single-document, or you must accept eventual consistency with compensating logic. Any system of record built on it has to enforce data integrity in application code.
Which PHP MongoDB driver does mongodb-lite require?
It runs on the legacy ext-mongo driver generation, which is sensitive to MongoDB server version mismatch. The failure mode is the worst kind: connections succeed but specific operations fail later. Pin both the driver and the server version, and have a named owner for compatibility testing.
Is jenssegers/mongodb-lite still maintained, and what are the alternatives?
It shows the classic signs of an abandoned package: a single maintainer, no visible CI or test matrix, zero dependents, and a changelog whose only entry is a framework constraint bump. There is no support commitment and no credible upgrade path. If you adopt it, isolate it behind an internal interface so replacement is a rebind rather than a refactor, and name a dated exit plan.
Can I use mongodb-lite in a new Laravel project or as a production system of record?
It is only appropriate for an actively maintained Laravel 4.2 application with a contained, non-critical document-storage need. Laravel 4.2 and the PHP runtime it implies are out of support, so unpatched framework and PHP CVEs are a standing exposure the package cannot mitigate. For new builds or anything requiring integrity guarantees, choose a maintained MongoDB driver or the full laravel-mongodb package instead.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons