colinmollenhour / mongodb-php-odm

A simple but powerful set of wrappers for using MongoDb in PHP (also a Kohana 3 module)
BSD 3-Clause "New" or "Revised" License
208 stars 50 forks source link

Trying to load a non-existent document will keep it’s ID in the object. #39

Closed panrafal closed 11 years ago

panrafal commented 11 years ago

You can reuse this object to create a new one...

This will create/update the document {_id: 123, foo: 'bar'}. (previously, the document would have an auto generated id).

$doc = new SomeDoce(123);
$doc->load();
$doc->foo = 'bar';
$doc->save();