Skip to content

Commit 090c48b

Browse files
committed
PHPLIB-235: Document BSON model classes
1 parent bdec3e1 commit 090c48b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

docs/reference/bson.txt

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,36 @@ BSON spec, see `bsonspec.org <http://bsonspec.org/>`_.
1919

2020
By default, the |php-library| returns BSON documents as
2121
:phpclass:`MongoDB\\Model\\BSONDocument` objects and BSON arrays as
22-
:phpclass:`MongoDB\\Model\\BSONArray` objects.
23-
:phpclass:`BSONDocument <MongoDB\\Model\\BSONDocument>` and
24-
:phpclass:`BSONArray <MongoDB\\Model\\BSONArray>` extend PHP's
25-
:php:`ArrayObject <arrayobject>` class and implement the driver's
26-
:php:`MongoDB\\BSON\\Serializable <mongodb-bson-serializable>` and
27-
:php:`MongoDB\\BSON\\Unserializable <mongodb-bson-unserializable>` interfaces.
22+
:phpclass:`MongoDB\\Model\\BSONArray` objects, respectively.
23+
24+
BSON Classes
25+
------------
26+
27+
.. phpclass:: MongoDB\\Model\\BSONArray
28+
29+
This class extends PHP's :php:`ArrayObject <arrayobject>` class. It also
30+
implements PHP's :php:`JsonSerializable <jsonserializable>` interface and the
31+
driver's :php:`MongoDB\\BSON\\Serializable <mongodb-bson-serializable>` and
32+
:php:`MongoDB\\BSON\\Unserializable <mongodb-bson-unserializable>`
33+
interfaces.
34+
35+
By default, the library will deserialize BSON arrays as instances of this
36+
class. During BSON and JSON serialization, instances of this class will
37+
serialize as an array type (:php:`array_values() <array_values>` is used
38+
internally to numerically reindex the array).
39+
40+
.. phpclass:: MongoDB\\Model\\BSONDocument
41+
42+
This class extends PHP's :php:`ArrayObject <arrayobject>` class. It also
43+
implements PHP's :php:`JsonSerializable <jsonserializable>` interface and the
44+
driver's :php:`MongoDB\\BSON\\Serializable <mongodb-bson-serializable>` and
45+
:php:`MongoDB\\BSON\\Unserializable <mongodb-bson-unserializable>`
46+
interfaces.
47+
48+
By default, the library will deserialize BSON documents as instances of this
49+
class. During BSON and JSON serialization, instances of this class will
50+
serialize as a document type (:php:`object casting
51+
<types.type-juggling#language.types.typecasting>` is used internally).
2852

2953
Type Maps
3054
---------

0 commit comments

Comments
 (0)