Skip to content

Commit e66dbc3

Browse files
committed
JM tech review 1
1 parent b516aa2 commit e66dbc3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

source/includes/usage-examples/sample-app.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
require __DIR__ . '/../vendor/autoload.php';
44

5-
use MongoDB\Client;
5+
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset');
6+
$client = new MongoDB\Client($uri);
67

7-
$client = new Client('<connection string>');
8-
$collection = $client-><database>-><collection>;
8+
$collection = $client->selectCollection('<database>', '<collection>');
99

1010
// Start example code here
1111

source/indexes.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ different types of indexes by using the {+php-library+}.
3838

3939
To use an example from this page, copy the code example into the
4040
:ref:`sample application <php-index-sample>` or your own application.
41-
Be sure to replace all placeholders in the code examples, such as
42-
``<connection string>``, with the relevant values for your MongoDB
43-
deployment.
41+
Make sure to set the ``MONGODB_URI`` environment variable to the
42+
connection string for your MongoDB deployment, and replace the
43+
``<database>`` and ``<collection>`` placeholders with values for your
44+
target namespace.
4445

4546
.. _php-index-sample:
4647

0 commit comments

Comments
 (0)