The PHP team is happy to announce that version 5.0.0-RC1 of the MongoDB integration for Laravel is now available. This is a release candidate for which we'd like to receive your feedback in the discussion.
Breaking changes for better compatibility with Laravel and Eloquent
id
is always alias to_id
in MongoDB. You can remove theprotected $primaryKey = '_id'
in model classes. Replace all$model->_id
with$model->id
.DateTimeInterface
objects (includingCarbon
) are converted to MongoDBUTCDateTime
by the query builder in queries, inserted and updated data. In results, MongoDBUTCDateTime
objects are automatically converted toCarbon
date with the default timezone. Some Eloquent cast my no longer be required.- Results of the Query Builder are returned as
stdClass
instead ofarray
. Replace code like$item['name']
with$item->name
. $collection
is replaced by$table
to customize the name of an Eloquent Model.- The providers
Auth\PasswordResetServiceProvider
,MongoDBQueueServiceProvider
andQueue\Failed\MongoFailedJobProvider
are removed. Remove them from your application. The MongoDB connection is compatible with the Laravel classes MongoDB\Laravel\Connection
is replaced byMongoDB\Connection
, and query are logged using MongoDB Monitoring Events.
What's Changed
New Features
- PHPORM-147 Make
id
an alias for_id
by @GromNaN in #3040 - PHPORM-230 Convert DateTimeInterface to UTCDateTime in queries by @GromNaN in #3105
- PHPORM-216 Remove $collection setting from DocumentModel and Connecti… by @GromNaN in #3104
- PHPORM-229 Make Query\Builder return objects instead of array to match Laravel behavior by @GromNaN in #3107
- PHPORM-231 Remove MongoFailedJobProvider by @GromNaN in #3122
- Remove support for Laravel 10 by @GromNaN in #3123
- PHPORM-234 Convert dates in DB Query results by @GromNaN in #3119
- PHPORM-235 Remove custom DatabaseTokenRepository by @GromNaN in #3124
- PHPORM-56 Replace Collection proxy class with Driver monitoring by @GromNaN in #3137
Other Changes
- DOCSP-42794: Laravel Passport by @norareidy in #3113
- DOCSP-43115 - v4.8 compat by @mongoKart in #3125
- Update PR template by @GromNaN in #3121
- Remove MongoDBQueueServiceProvider in composer.json by @masterbater in #3131
- PHPORM-157 Remove
Blueprint::background()
by @GromNaN in #3132 - DOCSP-43158: carbon date values db query results by @rustagir in #3133
- PHPORM-236 Remove _id from query results by @GromNaN in #3136
- DOCSP-41335: Id field alias by @norareidy in #3042
- DOCSP-43172: Remove DatabaseTokenRepository class by @norareidy in #3130
New Contributors
- @masterbater made their first contribution in #3131
Full Changelog: 4.8.0...5.0.0-rc1