Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Simple and efficient ActiveRecord data abstraction for MongoDB
PHP Shell
Branch: master
Fetching latest commit...
Cannot retrieve the latest commit at this time.


Really simple Activedocument for MongoDB

MongoDB is a very powerful database, high performance and amicable. I wrote an article about it,

ActiveMongo, is a simple yet efficient MongoDB abstraction, following the Activedocument pattern. Visit for further details.

Comments, patches, bug reports are welcome to the blog post, my personal e-mail address, 

 What it does now:

- Handle MongoDB connection, connecting once when it is needed
- Define a Collection as a class
- Abstracts iteration over a dataset
- Efficient save() which creates or updates efficiently (using $unset, $set) a document
- Provides simple queries interface, but allows to get MongoCollection for complex queries in sub-classes
- Delete current object, Drop() table
- Support filtering per property
- Support for efficient updates on nested documents
- Support Hooks:
    - pre_save($operation, Array &$document): Right before to perform and insert or update
    - on_save(): When a document is created
    - on_update(): When a document is updated
    - on_iterate(): On iteration, when the cursor moves to the next document
- Support simple yet useful collection installation, useful to create indexes and shard keys.
- Efficient references to another document, and an efficient way to load it (with one query if possible)
- Dynamic References (AKA, save a query to execute later)


- PHP Streams support for GridFS
- Tools for setup and manage a sharded environment 
Something went wrong with that request. Please try again.