0
有沒有什麼明顯的我做錯了這段代碼?在mongoDb gridFs上刪除文件的結果爲「0」,即使它存在
$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;
}
有時引發異常(意思是結果爲0)。我很確定該文件存在,並在之後被刪除。我在一個批處理作業中針對具有2個分片和2個複製集的mongoDb集羣運行此操作。
我懷疑是mongoDb裏的一個PHP驅動程序(也許'safe'=> true doens't work),或者可能是一些分片問題。
任何想法?谷歌無法真正幫助:-(
問候
馬爾科
謝謝,這很有可能。 – Marko