MongoDB PHP Library
On this page
- Overview
- Get Started
- Connect to MongoDB
- Databases and Collections
- Read Data from MongoDB
- Write Data to MongoDB
- Specify How CRUD Operations Run on Replica Sets
- Run a Database Command
- Transform Your Data with Aggregation
- Optimize Queries with Indexes
- Monitoring
- Secure Your Data
- Specialized Data Formats
- Compatibility
- What's New
- Upgrade Library Versions
- FAQ
Overview
Welcome to the documentation site for the official MongoDB PHP Library.
The PHP library provides a high-level abstraction around the lower-level mongodb extension.
The mongodb
extension provides a limited API to connect to a MongoDB
database and execute generic commands, queries, and write operations. In
contrast, the PHP library provides a full-featured API and models client,
database, and collection objects. If you are developing a PHP application with
MongoDB, consider using the PHP library instead of the extension alone.
Get Started
Learn how to install the library and extension, establish a connection to MongoDB, and begin working with data in the Get Started with the PHP Library tutorial.
Connect to MongoDB
Learn how to create and configure a connection to a MongoDB deployment in the Connect to MongoDB section.
Databases and Collections
Learn how to use the PHP library to work with MongoDB databases and collections in the Databases and Collections section.
Read Data from MongoDB
Learn how you can retrieve data from MongoDB in the Read Data from MongoDB section.
Write Data to MongoDB
Learn how you can write data to MongoDB in the Write Data to MongoDB section.
Specify How CRUD Operations Run on Replica Sets
Learn how to configure settings for read and write operations on replica sets in the Specify How CRUD Operations Run on Replica Sets section.
Run a Database Command
Learn how to run a database command in the Run a Database Command section.
Transform Your Data with Aggregation
Learn how to use the PHP library to perform aggregation operations in the Transform Your Data with Aggregation section.
Optimize Queries with Indexes
Learn how to work with common types of indexes in the Optimize Queries by Using Indexes section.
Monitoring
Learn how to monitor change events in the Monitor Your Application section.
Secure Your Data
Learn about ways you can authenticate your application and encrypt your data in the Secure Your Data section.
Specialized Data Formats
Learn how to work with specialized data formats and custom types in the Specialized Data Formats section.
Compatibility
See compatibility tables showing the recommended PHP library version to use for specific PHP and MongoDB Server versions in the Compatibility section.
What's New
Learn about new features and changes in each version in the What's New section.
Upgrade Library Versions
Learn what changes you must make to your application to upgrade library and extension versions in the Upgrade Library Versions section.
FAQ
See answers to commonly asked questions about the PHP library in the the Frequently Asked Questions section.