@@ -109,6 +109,47 @@ This library version introduces the following breaking changes:
109109 of this behavior, you cannot have two separate ``id`` and ``_id`` fields in your
110110 documents.
111111
112+ - Removes support for the ``$collection`` property. The following code shows
113+ how to assign a MongoDB collection to a variable in your ``User`` class in
114+ older versions compared to v5.0:
115+
116+ .. code-block:: php
117+ :emphasize-lines: 10-11
118+
119+ use MongoDB\Laravel\Eloquent\Model;
120+
121+ class User extends Model
122+ {
123+ protected $keyType = 'string';
124+
125+ // older versions
126+ protected $collection = 'app_user';
127+
128+ // v5.0
129+ protected $table = 'app_user';
130+
131+ ...
132+ }
133+
134+ This release also modifies the associated ``DB`` and ``Schema`` methods for
135+ accessing a MongoDB collection. The following code shows how to access the
136+ ``app_user`` collection in older versions compared to v5.0:
137+
138+ .. code-block:: php
139+ :emphasize-lines: 9-11
140+
141+ use Illuminate\Support\Facades\Schema;
142+ use Illuminate\Support\Facades\DB;
143+ use MongoDB\Laravel\Schema\Blueprint;
144+
145+ // older versions
146+ Schema::collection('app_user', function (Blueprint $collection) { ... });
147+ DB::collection('app_user')->find($id);
148+
149+ // v5.0
150+ Schema::table('app_user', function (Blueprint $table) { ... });
151+ DB::table('app_user')->find($id);
152+
112153.. _laravel-breaking-changes-v4.x:
113154
114155Version 4.x Breaking Changes
0 commit comments