File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 6
6
7
7
// End example code here
8
8
9
- $ admin = $ client ->admin ;
10
- $ result = $ admin ->command (['ping ' => 1 ]);
11
-
12
- if ($ result ) {
9
+ try {
10
+ $ client ->test ->command (['ping ' => 1 ]);
13
11
echo 'Successfully pinged the MongoDB server. ' , PHP_EOL ;
14
- } else {
15
- echo ' Ping to MongoDB server failed. ' , PHP_EOL ;
12
+ } catch ( MongoDB \ Driver \ Exception \ RuntimeException $ e ) {
13
+ printf ( " Failed to ping the MongoDB server: %s \n" , $ e -> getMessage ()) ;
16
14
}
Original file line number Diff line number Diff line change @@ -146,8 +146,8 @@ The following sections show how to connect to MongoDB by using the ``MONGODB-AWS
146
146
authentication mechanism. When you use the ``MONGODB-AWS`` mechanism, the {+php-library+}
147
147
attempts to retrieve your AWS credentials from the following sources, in the order listed:
148
148
149
- 1. Options parameter passed to the ``MongoDB\Client`` constructor or parameters in the
150
- connection URI
149
+ 1. Options passed to the ``MongoDB\Client`` constructor, either as part of the connection
150
+ string or the ``$uriOptions`` array parameter
151
151
#. Environment variables
152
152
#. AWS EKS ``AssumeRoleWithWebIdentity`` request
153
153
#. ECS container metadata
You can’t perform that action at this time.
0 commit comments