Skip to content

crodas/ActiveMongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Really simple Activedocument for MongoDB
----------------------------------------

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

http://www.phpclasses.org/blog/post/118-Developing-scalable-PHP-applications-using-MongoDB.html

ActiveMongo, is a simple yet efficient MongoDB abstraction, following the Activedocument pattern. Visit http://crodas.org/activemongo.php for further details.

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


 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)

TODO:

- PHP Streams support for GridFS
- Tools for setup and manage a sharded environment 

About

Simple and efficient ActiveRecord data abstraction for MongoDB

Resources

License

Stars

Watchers

Forks

Packages

No packages published