PHP Using MongoDB Connect to MongoDB

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Create a MongoDB connection, that later you can query:

$manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017');

In the next example, you will learn how to query the connection object.

This extension close the connection automatically, it's not necessary to close manually.



Got any PHP Question?