\r\n"; include('/var/shared/vendor/autoload.php'); echo "Step 2: Access username and password from " . "outside location.
\r\n"; include($_SERVER["CONTEXT_DOCUMENT_ROOT"] . '/../htpasswd/mongodb.inc'); echo "Step 3: Connect to the MongoDB database.
\r\n"; $client = new MongoDB\Client ( "mongodb://$username:$password@localhost/u30" ); echo "Step 4: Connect to the document within the database.

\r\n"; $collection = $client->u30->quotes_mongo; $result = $collection->find( [ 'author'=>'Winston Churchill' ] ); foreach ($result as $entry) { echo $entry['_id'], ': ', $entry['text'], "
\r\n"; } echo "
\r\n"; $result = $collection->find ( [ 'author'=>'Winston Churchill', 'adjective'=>'profound' ] ); foreach ($result as $entry) { echo $entry['_id'], ': ', $entry['text'], "
\r\n"; } ?>