Helper functions

Mongo_Collection::get_query(), geoNear(), mapReduce(), distinct(), aggregate(), isCapped(), emptyCapped(), stats()
Mongo_Database::connection()
formatting
$_references allow to use getter and setter functions for properties
actual loading moved to load_if_needed()
Mongo_Document::is_new()
Mongo_Document::get_field_reference(), and static helpers get_named_reference() unset_named_reference()

Allow to access direct references to subdocuments using dot notation
get() and get_raw() for getting values using dot notation. __isset() also allows for dot notation checking
Most of mongo field functions like inc, push, pull etc. can be emulated, so you don’t have to reload the document to see the changed values. Actual document processing is of course still done on the server.

You can enable it by default by setting $_emulate to true, or using set_emulation(true)
emulation test
KWeb_Document implements ArrayAccess. It allows for dot notation fetching, and always uses emulation for setting.
Mongo_Subdocument allows to create simple models for subdocuments
Fallback to old Mongo() class if MongoClient() is not found

This is related to https://github.com/colinmollenhour/mongodb-php-odm/pull/44.
On dev machines it's easy to get the last MongoDB PHP driver but on production servers, this PHP driver is not necessary at the last version.
This small fix allows to use either MongoClient() or Mongo() as a fallback.
Merge pull request #49 from semalead/fallback-to-mongo-class

Fallback to old Mongo() class if MongoClient() is not found
Fixed remove_safe parameters.  may be empty
Merge pull request #50 from sergeyklay/fix-remove_safe

Fixed Mongo_Collection::remove_safe
Merge pull request #31 from panrafal/feature-helpers

Helper functions - some mirroring JS API, plus two helpers: get_query and connection
Added some DB helpers
Fixed execute_safe. If an error occurs $result  will contain 'code' field instead 'errno'
Revert "update_safe accepts $upset and $multi options"

This reverts commit feca19eac3ab1e0e130b48084fc66a5c8f8c9115.
php5.3 compatible