Skip to content

Commit 573bd0a

Browse files
p-mongop
andauthored
RUBY-2880 Implement driver-compatible DBRef constructor (#282)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent 311c213 commit 573bd0a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/tutorials/bson-v4.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,9 @@ Represents a string of JavaScript code with a hash of values.
405405

406406
BSON::CodeWithScope.new("this.value = age;", age: 5)
407407

408+
408409
``BSON::DBRef``
409-
------------------
410+
---------------
410411

411412
This is a subclass of ``BSON::Document`` that provides accessors for the
412413
collection, id, and database of the DBRef.
@@ -437,6 +438,16 @@ collection, id, and database of the DBRef.
437438
loaded.class
438439
=> BSON::DBRef
439440

441+
For backwards compatibility with the MongoDB Ruby driver versions 2.17 and
442+
earlier, ``BSON::DBRef`` also can be constructed using the legacy driver API.
443+
This API is deprecated and will be removed in a future version of ``bson-ruby``:
444+
445+
.. code-block:: ruby
446+
447+
BSON::DBRef.new("collection", BSON::ObjectId('61eeb760a15d5d0f9f1e401d'))
448+
BSON::DBRef.new("collection", BSON::ObjectId('61eeb760a15d5d0f9f1e401d'), "db")
449+
450+
440451
``BSON::Document``
441452
------------------
442453

0 commit comments

Comments
 (0)