Skip to content

Commit b950042

Browse files
committed
JT feedback
1 parent 6b68a97 commit b950042

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

source/includes/read/retrieve.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require 'vendor/autoload.php';
33

4-
$uri = "<connection string>";
4+
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset');
55
$client = new MongoDB\Client($uri);
66

77
// start-db-coll
@@ -29,14 +29,12 @@
2929

3030
// Finds and prints up to 5 documents with a "number_of_employees" value of 1000
3131
// start-modify
32-
$options = [
33-
'limit' => 5,
34-
];
35-
36-
$results = $collection->find(['number_of_employees' => 1000], $options);
32+
$results = $collection->find(
33+
['number_of_employees' => 1000],
34+
['limit' => 5]
35+
);
3736

3837
foreach ($results as $doc) {
3938
echo json_encode($doc) . "\n";
4039
}
41-
// end-modify
42-
?>
40+
// end-modify

0 commit comments

Comments
 (0)