Laravel Feature Compatibility
On this page
Overview
This guide describes the Laravel features that are supported by Laravel MongoDB. This page discusses Laravel version 11.x feature availability in the Laravel Integration.
The following sections contain tables that describe whether individual features are available in the Laravel Integration.
Database Features
Eloquent Feature | Availability |
---|---|
Configuration | ✓ |
Read/Write Connections | Use read preference instead. |
Multiple Database Connections | ✓ |
Listening for Query Events | ✓ |
Monitoring Cumulative Query Time | ✓ |
Transactions | ✓ See Transactions. |
Command Line Interface (CLI) | Use the MongoDB Shell ( mongosh ). |
Database Inspection | Unsupported |
Database Monitoring | Unsupported |
Query Features
The following Eloquent methods are not supported in the Laravel Integration:
toSql()
toRawSql()
whereColumn()
orWhereColumn()
whereFulltext()
groupByRaw()
orderByRaw()
inRandomOrder()
union()
unionAll()
havingRaw()
having()
havingBetween()
orHavingRaw()
whereIntegerInRaw()
orWhereIntegerInRaw()
whereIntegerNotInRaw()
orWhereIntegerNotInRaw()
Eloquent Feature | Availability |
---|---|
Running Queries | ✓ |
Chunking Results | ✓ |
Aggregates | ✓ |
Select Statements | ✓ |
Raw Expressions | Unsupported |
Joins | Unsupported |
Unions | Unsupported |
✓ | |
✓ | |
Logical Grouping | ✓ |
✓ | |
Unsupported | |
Ordering | ✓ |
Random Ordering | Unsupported |
Grouping | Partially supported, use Aggregations. |
Limit and Offset | ✓ |
Conditional Clauses | ✓ |
Insert Statements | ✓ |
Auto-Incrementing IDs | Unsupported as MongoDB uses ObjectIDs |
Upserts | |
Update Statements | ✓ |
Updating JSON Columns | Unsupported |
Increment and Decrement Values | ✓ |
Debugging | ✓ |
Pagination Features
The Laravel Integration supports all Laravel pagination features.
Migration Features
The Laravel Integration supports all Laravel migration features, but the implementation is specific to MongoDB's schemaless model.
Seeding Features
The Laravel Integration supports all Laravel seeding features.
Eloquent Features
Eloquent Feature | Availability |
---|---|
Models | ✓ |
UUID and ULID Keys | ✓ |
Timestamps | ✓ |
Retrieving Models | ✓ |
Advanced Subqueries | Unsupported |
Retrieving or Creating Models | ✓ |
Retrieving Aggregates | Partially supported |
Inserting and Updating Models | ✓ |
Upserts | |
Deleting Models | ✓ |
Soft Deleting | ✓ |
Pruning Models | ✓ |
Tip
To learn more, see the Eloquent Model Class guide.
Eloquent Relationship Features
Eloquent Feature | Availability |
---|---|
Defining Relationships | ✓ |
Many-to-Many Relationships | ✓ |
Polymorphic Relationships | ✓ |
Dynamic Relationships | ✓ |
Querying Relations | ✓ |
Aggregating Related Models | Unsupported |
Inserting and Updating Related Models | ✓ |
Tip
To learn more, see the Eloquent Model Relationships guide.
Eloquent Collection Features
The Laravel Integration supports all Eloquent collection features.
Eloquent Mutator Features
Eloquent Feature | Availability |
---|---|
Casts | ✓ |
Array and JSON Casting | ✓ You can store objects and arrays in MongoDB without serializing to JSON. |
Date Casting | ✓ |
Enum Casting | ✓ |
Encrypted Casting | ✓ |
Custom Casts | ✓ |
Tip
To learn more, see the Eloquent Model Class guide.
Eloquent Model Factory Features
The Laravel Integration supports all Eloquent factory features.