coen-hyde/Shanty-Mongo — Issue #52: Updating or inserting depending on existing data
Author: tholder
Created: 2011-11-10 09:52:43+00:00
State: open

What's the best way to go about doing the equivalent of a MySQL REPLACE (not that I especially liked that!).

At the moment I'm doing similar to:

$data = array(
'user' => $app->user->getId(),
'key' => $keyValue['key']
);

$appData = Model_Mongo_UserData::one($data);
if(!$appData) {
$appData = new Model_Mongo_UserData($data);
}