| @@ 828-834 (lines=7) @@ | ||
| 825 | $result = $this->_mongoCollection->insert($document); |
|
| 826 | ||
| 827 | // if write concern acknowledged |
|
| 828 | if(is_array($result)) { |
|
| 829 | if($result['ok'] != 1) { |
|
| 830 | throw new Exception('Insert error: ' . $result['err'] . ': ' . $result['errmsg']); |
|
| 831 | } |
|
| 832 | ||
| 833 | return $this; |
|
| 834 | } |
|
| 835 | ||
| 836 | // if write concern unacknowledged |
|
| 837 | if(!$result) { |
|
| @@ 127-129 (lines=3) @@ | ||
| 124 | $result = $this->_mongoCollection->delete($id); |
|
| 125 | } |
|
| 126 | } |
|
| 127 | if($result['ok'] !== (double) 1) { |
|
| 128 | throw new Exception('Error deleting file: ' . $result['err'] . ': ' . $result['errmsg']); |
|
| 129 | } |
|
| 130 | ||
| 131 | return $this; |
|
| 132 | } |
|