This tutorial provides an introduction to basic database operations using the mongo shell. MongoDB is a document database that provides high performance, high availability, and easy scalability.

How Access MongoDB from PHP
To access MongoDB from PHP you need:

  • The MongoDB server running. The server is the “mongod” file,
    not the “mongo” client (note the “d” at the end).
  • The MongoDB PHP driver installed.

Make a connection string & Select a database
To maek connection string & select the database in php simply used the bellow snippats.
Create a config.php file.

Select all Data

Delete Data
In the part of useful CRUD there is ability to delete the data records. MonogoDB provides a method remove() for this which only takes an array of data attributes as the criteria to removing the data records.

Update the data
In the CRUD oprations there is also ability to update the records. In MongoDB have a simple method save() for this which require an array of criteria to know which records would be updated. Bellow is the example fo updating the data records.