is there anything obvious I'm doing wrong with this code?
$result = $this->_grid->remove(
$someQueryWithOneResult, array('safe' => true, 'justOne' => true)
);
if ($result['n'] === 0) {
throw new FileNotFoundException("no file with xuuid '" . $xuuid . "'", 404);
} else if ($result['n'] === 1) {
return true;
}
Sometimes the exception is thrown (meaning the result was 0). I'm quite sure the file exists and it is deleted afterwards. I run this in a batch job against a mongoDb cluster with 2 shards and 2 replicasets.
I suspect a bug inside mongoDb either PHP driver (maybe 'safe' => true doens't work), or maybe some problem with the shard.
Any ideas? Google couldn't really help :-(
Regards
Marko