Skip to content

Commit c3f16f5

Browse files
committed
feedback
1 parent 91bb0ed commit c3f16f5

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

source/includes/connect/atlas.php

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
<?php
22

3-
try {
4-
// Replace the placeholder with your Atlas connection string
5-
$uri = "<connection string>";
3+
// Replace the placeholder with your Atlas connection string
4+
$uri = "<connection string>";
65

7-
// Create a MongoDB client with server API options
8-
$client = new MongoDB\Client($uri, [], [
9-
'serverApi' => new MongoDB\Driver\ServerApi('1')
10-
]);
6+
// Create a MongoDB client with server API options
7+
$client = new MongoDB\Client($uri, [], [
8+
'serverApi' => new MongoDB\Driver\ServerApi('1')
9+
]);
1110

12-
// Ping the server to verify that the connection works
13-
$admin = $client->admin;
14-
$command = new MongoDB\Driver\Command(['ping' => 1]);
15-
$result = $admin->command($command)->toArray();
11+
// Ping the server to verify that the connection works
12+
$admin = $client->admin;
13+
$command = new MongoDB\Driver\Command(['ping' => 1]);
14+
$result = $admin->command($command)->toArray();
1615

17-
echo json_encode($result), "\n";
18-
echo "Pinged your deployment. You successfully connected to MongoDB!\n";
19-
} catch (Exception $e) {
20-
echo "An exception occurred: ", $e->getMessage(), "\n";
21-
exit(EXIT_FAILURE);
22-
}
23-
?>
16+
echo json_encode($result), "\n";
17+
echo "Pinged your deployment. You successfully connected to MongoDB!\n";
18+
19+
?>

0 commit comments

Comments
 (0)