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 Core

Mongodb Core Laravel Package

jenssegers/mongodb-core

Core library powering Laravel MongoDB integration, providing the connection, query builder, and Eloquent model foundations used by jenssegers/mongodb. It enables MongoDB-backed models and fluent queries in Laravel while keeping shared internals separate for reuse and maintenance.

View on GitHub
Deep Wiki
Context7

A MongoDB based Query builder for Laravel

Frequently asked questions about Mongodb Core
What is jenssegers/mongodb-core used for?
jenssegers/mongodb-core is the low-level MongoDB query builder and connection layer that powers the jenssegers/laravel-mongodb integration. It lets Laravel developers write fluent where, select, and aggregate style queries against MongoDB using idioms that mirror Illuminate\Database\Query\Builder. It is not a full ORM on its own; Eloquent model support and the Laravel service provider wiring live in the sibling laravel-mongodb package.
Should I install jenssegers/mongodb-core or jenssegers/laravel-mongodb?
Most teams should install jenssegers/laravel-mongodb and treat mongodb-core as an internal dependency rather than requiring it directly. Depending on the core package alone gives you the query builder but leaves you to handle service provider registration and connection resolver expectations yourself. Choose it directly only if you have a deliberate reason to reuse the builder layer without the full Eloquent integration, and document that decision.
How do I install jenssegers/mongodb-core with Composer?
Run composer require jenssegers/mongodb-core and make sure the ext-mongodb PHP extension is installed on every runtime, including CLI, web, and queue workers. Installation is low effort, but verify that the core version you pull matches the version range required by jenssegers/laravel-mongodb if you use both. Because the package is a split-out internal layer, pinning an explicit version is safer than relying on floating constraints.
Which Laravel, PHP, and MongoDB versions are supported?
Support tracks the parent laravel-mongodb package rather than having an independent compatibility promise, so check that package's composer.json for exact constraints. In practice you should expect PHP 8.x with Laravel 9, 10, or 11 and a compatible ext-mongodb driver. Also confirm the MongoDB server versions your driver supports, since server compatibility is dictated by the PHP driver, not the query builder.
Does jenssegers/mongodb-core require the ext-mongodb PHP extension?
Yes. The package talks to MongoDB through the mongodb/mongodb library, which requires the ext-mongodb PHP extension. Installing the Composer package alone is not enough; the extension must be compiled or enabled in every environment that runs the code. Treat extension availability as an infrastructure gate in your deployment checklist.
Can I use jenssegers/mongodb-core without Laravel or in Lumen?
It is designed for Laravel and Lumen style applications and assumes Laravel connection resolution and service provider conventions. Using it in plain PHP or framework-agnostic microservices means wiring those expectations yourself, which is usually more trouble than it saves. For non-Laravel projects, consider the raw mongodb/mongodb driver or Doctrine MongoDB ODM instead.
How do I run aggregation pipelines like $lookup and $group with jenssegers/mongodb-core?
The builder exposes aggregation helpers, but complex pipelines involving $lookup, $group, or multi-stage transforms often require falling back to the raw driver. Before committing, prototype one realistic pipeline and one transaction scenario; if both need raw-driver escape hatches, the ergonomic benefit is largely negated. This abstraction ceiling is the main technical risk to validate.
Is jenssegers/mongodb-core production ready and actively maintained?
The package inherits the maintenance posture and release cadence of the parent laravel-mongodb project and does not have an independent roadmap. It is best treated as a transitive or split-out artifact rather than a directly consumed library, so review the parent repository for security policy and release activity. Avoid introducing it as a standalone dependency without confirming who maintains it and how upgrades are coordinated.
Is jenssegers/mongodb-core safe to use with Laravel Octane and long-running queue workers?
The query builder assumes request-scoped connection resolution, so long-lived workers such as Laravel Octane and queue consumers deserve explicit testing. Verify that connections are not leaked or reused incorrectly across requests and that MongoDB connection pooling behaves as expected under load. Run a load test with your actual worker configuration before relying on it in production.
How do I test code that uses jenssegers/mongodb-core?
There is no built-in fake like SQLite for SQL, so test against a real MongoDB instance, for example a disposable container or an in-memory MongoDB server. Focus integration tests on the queries and aggregation pipelines you actually use rather than mocking the builder, which provides little confidence. Keep tests versioned against the same MongoDB server and driver versions you run in production.
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