Skip to content

Commit 222cf2a

Browse files
committed
edits
1 parent 1123fab commit 222cf2a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

source/data-formats/modeling-bson-data.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Create a BSON Document
5252

5353
You can create a BSON document by using the same notation you use to create an
5454
associative array in {+language+}. The {+library-short+} automatically converts
55-
{+language+} arrays into BSON documents when inserting them into a collection.
55+
these values into BSON documents when inserting them into a collection.
5656

5757
The following example creates a BSON document that represents the preceding
5858
:ref:`sample BSON document <php-bson-sample>`:
@@ -71,7 +71,6 @@ modify an associative array in {+language+}. This example makes the following ch
7171
to the :ref:`sample BSON document <php-bson-sample>`:
7272

7373
- Adds a new ``restaurant_id`` field that has a value of ``12345``
74-
- Removes the ``cuisine`` field
7574
- Sets the value of the ``name`` field to ``"Mongo's Pizza Place"``
7675

7776
.. literalinclude:: /includes/bson.php
@@ -127,8 +126,8 @@ This type map performs the following conversions:
127126
- Top-level and embedded BSON documents to ``MongoDB\Model\BSONDocument`` objects
128127

129128
A type map can specify any class that implements
130-
:php:`MongoDB\BSON\Unserializable <mongodb-bson-unserializable>`, as well as
131-
the ``array``, ``stdClass``, and ``object`` types.
129+
:php:`MongoDB\BSON\Unserializable <mongodb-bson-unserializable>`. It can
130+
also specify the ``array``, ``stdClass``, and ``object`` types.
132131

133132
Custom Type Map Example
134133
```````````````````````
@@ -259,7 +258,7 @@ methods:
259258
API Documentation
260259
-----------------
261260

262-
To learn more about any of the methods or types discussed in this
261+
To learn more about any of the {+library-short+} methods or types discussed in this
263262
guide, see the following library API documentation:
264263

265264
- :phpmethod:`MongoDB\Database::createCollection()`

source/includes/bson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset');
66
$client = new MongoDB\Client($uri);
7+
$db = $client->test;
78

89
// start-create-doc
910
$document = [
@@ -19,7 +20,6 @@
1920

2021
// start-modify-doc
2122
$document['restaurant_id'] = 12345;
22-
unset($document['cuisine']);
2323
$document['name'] = 'Mongo\'s Pizza Place';
2424
// end-modify-doc
2525

0 commit comments

Comments
 (0)