Connect to MongoDB
suggest changeCreate a connection with the mongodb extension. Later pages query through this manager:
$manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017');
In the next example, you will learn how to query the connection object.
The extension closes the connection when the request ends. You do not need to close it yourself.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents