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.
jenssegers/mongodb-core is the extracted query-builder layer underpinning the widely adopted jenssegers/laravel-mongodb package. It provides a MongoDB-flavored query builder (a fluent where/select/aggregate interface) that mirrors Laravel's Illuminate\Database\Query\Builder contract, allowing teams to write MongoDB queries using idioms familiar to Laravel developers. It is a low-level library, not a full ORM — the Laravel integration (Eloquent, connection management, auth) lives in the sibling package.
Architecture fit. The package is only appropriate if your stack is Laravel/Lumen and you need a query-builder abstraction over raw mongodb/mongodb driver calls without committing to the full Eloquent layer. It is a poor fit for non-Laravel PHP projects, for framework-agnostic microservices, or for teams that prefer to model MongoDB access via a dedicated ODM like Doctrine MongoDB ODM. Its value proposition is developer ergonomics and idiom alignment, not performance.
Integration feasibility. Low technical effort to install; the real cost is architectural commitment. Because the core package is designed to be consumed by the higher-level laravel-mongodb package, adopting it standalone means you inherit the coupling assumptions (service provider registration, connection resolver expectations) without the convenience of the full integration. In practice, most teams should evaluate laravel-mongodb first and treat mongodb-core as an internal dependency — which raises the question of whether standing it up as a direct dependency is a deliberate architectural decision or accidental.
Technical risk. The package has zero recorded dependents and a score of 0 in the provided metadata, which strongly suggests it is a transitive/split-out artifact rather than a directly-consumed library. It inherits the maintenance posture and release cadence of the parent laravel-mongodb project rather than having an independent roadmap. Key risks: (1) version skew between core and the parent integration, (2) MongoDB server-version compatibility tied to the underlying PHP driver, (3) the query-builder abstraction leaking (aggregation pipelines, $lookup, transactions) and forcing raw-driver escape hatches, and (4) the abstraction providing a false sense of portability — MongoDB semantics differ materially from SQL, so "write it like Eloquent" can hide performance traps.
Key questions to resolve before commitment: Who is the actual maintainer and what is the security-response policy? What MongoDB server versions and PHP driver versions are in the supported matrix? Does the parent laravel-mongodb package depend on this exact version range, and will upgrading one force upgrading the other? What is the escape-hatch story for complex aggregations? Is there a documented reason this package exists separately, or is it an internal split we should not depend on directly?
Stack fit. Suitable only for PHP 8.x on Laravel 9/10/11 (align with the parent package's matrix) with the ext-mongodb PHP extension installed. Confirm this against your actual runtime — extension installation is an infrastructure gate, not a composer line item. Teams running Laravel Octane or queue-heavy workloads should verify connection handling under long-lived workers, since the query builder assumes request-scoped connection resolution.
Migration path. Treat this as an additive capability rather than a replacement for an existing data layer. Recommended sequencing:
$lookup + $group) and one transaction scenario; if both require raw-driver fallback, the ergonomic benefit is largely negated and the decision should be revisited.laravel-mongodb package unless there is a documented reason to depend on mongodb-core directly. This reduces version-skew risk and gives you the Eloquent integration, connection pooling config, and community support surface.Compatibility. Pin the parent package and the core package together in composer.json and treat them as a single upgrade unit. Add a CI job that exercises the query builder against the production MongoDB server version — driver-level behavior differences (particularly around aggregation and collation) are the most common source of "works in dev, fails in prod."
Sequencing. Low-risk first increment: read-only query surfaces. Medium-risk second: write paths with idempotency keys. High-risk last: transactions and multi-document consistency — these are where MongoDB semantics and the builder abstraction diverge most and where you most need to prove the approach before committing broader architecture.
Maintenance. This is the dominant concern. A package with zero dependents and a 0 score is a signal, not a verdict — it most likely reflects a split-out internal module. The effective maintenance burden is the parent project's, so track jenssegers/laravel-mongodb release notes and security advisories, not this package's. Budget for upgrade churn tied to Laravel major releases and PHP driver updates; historically this ecosystem lags major Laravel versions by weeks to months, which matters if you upgrade promptly.
Support. Community support lives in the parent repository's issue tracker; expect no dedicated support channel or SLA. For a production-critical data layer, that is a material risk. Mitigate with internal expertise (at least one engineer who can read the package source and the underlying driver), a documented runbook, and a fallback plan to the raw mongodb/mongodb driver — the escape hatch here is genuinely viable because the builder is a thin layer.
Scaling. The query builder adds negligible runtime overhead versus the driver. Scaling concerns are MongoDB's, not the package's: index design, working-set sizing, sharding key selection, read-preference tuning, and connection-pool sizing under Octane. The abstraction can obscure query planning — developers writing "Laravel-style" queries may create unindexed scans without realizing it. Operational discipline required: slow-query profiling ($currentOp, the profiler, Atlas Performance Advisor), query-shape review in code review, and explicit index ownership.
Failure modes to plan for:
composer update; lock both and review diffs.Ramp-up. Low for Laravel developers — the fluent interface reads as familiar Eloquent, which is the package's core selling point; expect days, not weeks, for basic productivity. Higher for MongoDB correctness: developers fluent in SQL often carry assumptions (joins, transactions, schema enforcement) that do not transfer, and the builder's Eloquent-like surface can actively encourage those assumptions. Recommend a short internal enablement module covering MongoDB data modeling, index strategy, aggregation pipeline mental models, and the package's escape hatches to the raw driver. Pair that with the repository abstraction so that early mistakes are cheap to correct.
How can I help you explore Laravel packages today?