jerome
(Jérôme Tamarelle)
3
That’s the exact reason we added the aliasing in the MongoDB Query Builder: ensure maximum compatibility with Laravel and community packages.
In model classes, you can still refer to the primary key using $model->_id , this is pointing to the same internal attribute id. You don’t need to update all your codebase.
This is a breaking change only if you use the Database Query Builder, not the Eloquent Builder, nor with the Raw MongoDB query.
With Database Query Builder, you need to change $result['id'] to $result->id.
We plan to add an option to disable this automatic conversion for projects that have a id field in an embedded document.