Skip to content

Commit b318120

Browse files
committed
PHPLIB-455: Add BSON class mapping to upgrade guide
1 parent b164780 commit b318120

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

docs/upgrade.txt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,63 @@ been replaced with a general-purpose
235235
:phpmethod:`MongoDB\\Collection::bulkWrite()` method. Whereas the legacy driver
236236
only allowed bulk operations of the same type, the new method allows operations
237237
to be mixed (e.g. inserts, updates, and deletes).
238+
239+
BSON class upgrade guide
240+
~~~~~~~~~~~~~~~~~~~~~~~~
241+
242+
When upgrading from the legacy driver, classes like :php:`MongoId <mongoid>`
243+
have to be replaced with classes in the ``MongoDB\\BSON`` namespace. The
244+
following table lists all legacy classes along with the class that replaces
245+
them. When typehinting against BSON values, use type interfaces instead of their
246+
implementations.
247+
248+
.. list-table::
249+
:header-rows: 1
250+
251+
* - Legacy class
252+
- BSON type class
253+
- BSON type interface
254+
255+
* - :php:`MongoId <mongoid>`
256+
- :php:`MongoDB\\BSON\\ObjectId <mongodb_bson_objectid>`
257+
-
258+
259+
* - :php:`MongoCode <mongocode>`
260+
- :php:`MongoDB\\BSON\\Javascript <mongodb_bson_javascript>`
261+
- :php:`MongoDB\\BSON\\JavascriptInterface <mongodb_bson_javascriptinterface>`
262+
263+
* - :php:`MongoDate <mongodate>`
264+
- :php:`MongoDB\\BSON\\UTCDateTime <mongodb_bson_utcdatetime>`
265+
- :php:`MongoDB\\BSON\\UTCDateTimeInterface <mongodb_bson_utcdatetimeinterface>`
266+
267+
* - :php:`MongoRegex <mongoregex>`
268+
- :php:`MongoDB\\BSON\\Regex <mongodb_bson_regex>`
269+
- :php:`MongoDB\\BSON\\RegexInterface <mongodb_bson_regexinterface>`
270+
271+
* - :php:`MongoBinData <mongobindata>`
272+
- :php:`MongoDB\\BSON\\Binary <mongodb_bson_binary>`
273+
- :php:`MongoDB\\BSON\\BinaryInterface <mongodb_bson_binaryinterface>`
274+
275+
* - :php:`MongoInt32 <mongoint32>`
276+
- Dropped without replacement.
277+
-
278+
279+
* - :php:`MongoInt64 <mongoint64>`
280+
- :php:`MongoDB\\BSON\\Int64 <mongodb_bson_int64>`
281+
-
282+
283+
* - :php:`MongoDBRef <mongodbref>`
284+
- Dropped without replacement.
285+
-
286+
287+
* - :php:`MongoMinKey <mongominkey>`
288+
- :php:`MongoDB\\BSON\\MinKey <mongodb_bson_minkey>`
289+
- :php:`MongoDB\\BSON\\MinKeyInterface <mongodb_bson_minkeyinterface>`
290+
291+
* - :php:`MongoMaxKey <mongomaxkey>`
292+
- :php:`MongoDB\\BSON\\MaxKey <mongodb_bson_maxkey>`
293+
- :php:`MongoDB\\BSON\\MaxKeyInterface <mongodb_bson_maxkeyinterface>`
294+
295+
* - :php:`MongoTimestamp <mongotimestamp>`
296+
- :php:`MongoDB\\BSON\\Timestamp <mongodb_bson_timestamp>`
297+
- :php:`MongoDB\\BSON\\TimestampInterface <mongodb_bson_timestampinterface>`

0 commit comments

Comments
 (0)