Skip to content

Commit 99b39b9

Browse files
committed
code edits, output
1 parent fd3186d commit 99b39b9

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

source/includes/read/project.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
$cursor = $collection->find(['name' => 'Emerald Pub'], $options);
2525
foreach ($cursor as $doc) {
26-
echo json_encode($doc), PHP_EOL;
26+
echo json_encode($doc) . PHP_EOL;
2727
}
2828
// end-project-include
2929

@@ -41,7 +41,7 @@
4141

4242
$cursor = $collection->find(['name' => 'Emerald Pub'], $options);
4343
foreach ($cursor as $doc) {
44-
echo json_encode($doc), PHP_EOL;
44+
echo json_encode($doc) . PHP_EOL;
4545
}
4646
// end-project-include-without-id
4747

@@ -56,7 +56,7 @@
5656

5757
$cursor = $collection->find(['name' => 'Emerald Pub'], $options);
5858
foreach ($cursor as $doc) {
59-
echo json_encode($doc), PHP_EOL;
59+
echo json_encode($doc) . PHP_EOL;
6060
}
6161
// end-project-exclude
6262

source/read/project.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ value is ``'Emerald Pub'``, passing the options array as a parameter to ``find()
8181
.. output::
8282
:visible: false
8383

84-
{ "_id" : { "$oid" : "..." }, "borough" : "Manhattan", "cuisine" : "American", "name" : "Emerald Pub" }
85-
{ "_id" : { "$oid" : "..." }, "borough" : "Queens", "cuisine" : "American", "name" : "Emerald Pub" }
84+
{"_id":{"$oid":"..."},"borough":"Manhattan","cuisine":"American","name":"Emerald Pub"}
85+
{"_id":{"$oid":"..."},"borough":"Queens","cuisine":"American","name":"Emerald Pub"}
8686

8787
When you use a projection to specify fields to include in the return
8888
document, the ``_id`` field is also included by default. All other fields are
@@ -112,8 +112,8 @@ excludes the ``_id`` field from the projection:
112112
.. output::
113113
:visible: false
114114

115-
{ "borough" : "Manhattan", "cuisine" : "American", "name" : "Emerald Pub" }
116-
{ "borough" : "Queens", "cuisine" : "American", "name" : "Emerald Pub" }
115+
{"borough":"Manhattan","cuisine":"American","name":"Emerald Pub"}
116+
{"borough":"Queens","cuisine":"American","name":"Emerald Pub"}
117117

118118
Specify Fields to Exclude
119119
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -148,8 +148,10 @@ field value is ``'Emerald Pub'``, passing the options array as a parameter to
148148
.. output::
149149
:visible: false
150150

151-
{ "_id" : { "$oid" : "..." }, "borough" : "Manhattan", "cuisine" : "American", "name" : "Emerald Pub", "restaurant_id" : "40367329" }
152-
{ "_id" : { "$oid" : "..." }, "borough" : "Queens", "cuisine" : "American", "name" : "Emerald Pub", "restaurant_id" : "40668598" }
151+
{"_id":{"$oid":"..."},"borough":"Manhattan","cuisine":"American",
152+
"name":"Emerald Pub","restaurant_id":"40367329"}
153+
{"_id":{"$oid":"..."},"borough":"Queens","cuisine":"American",
154+
"name":"Emerald Pub","restaurant_id":"40668598"}
153155

154156
When you use a projection to specify which fields to exclude,
155157
any unspecified fields are implicitly included in the return document.

0 commit comments

Comments
 (0)