| @@ 830-836 (lines=7) @@ | ||
| 827 | // If the w parameter is set to acknowledge the write, |
|
| 828 | // returns an associative array with the status of the inserts ("ok") |
|
| 829 | // and any error that may have occurred ("err"). |
|
| 830 | if (is_array($result)) { |
|
| 831 | if ($result['ok'] != 1) { |
|
| 832 | throw new Exception('Batch insert error: ' . $result['err']); |
|
| 833 | } |
|
| 834 | ||
| 835 | return $this; |
|
| 836 | } |
|
| 837 | ||
| 838 | // Otherwise, returns TRUE if the batch insert was successfully sent, |
|
| 839 | // FALSE otherwise. |
|
| @@ 903-908 (lines=6) @@ | ||
| 900 | ); |
|
| 901 | ||
| 902 | // if write concern acknowledged |
|
| 903 | if (is_array($result)) { |
|
| 904 | if ($result['ok'] != 1) { |
|
| 905 | throw new Exception(sprintf('Update error: %s: %s', $result['err'], $result['errmsg'])); |
|
| 906 | } |
|
| 907 | return $this; |
|
| 908 | } |
|
| 909 | ||
| 910 | // if write concern unacknowledged |
|
| 911 | if (!$result) { |
|
| @@ 964-970 (lines=7) @@ | ||
| 961 | $result = $targetMongoCollection->batchInsert($documentList); |
|
| 962 | ||
| 963 | // check result |
|
| 964 | if (is_array($result)) { |
|
| 965 | if ($result['ok'] != 1) { |
|
| 966 | throw new Exception('Batch insert error: ' . $result['err']); |
|
| 967 | } |
|
| 968 | } elseif (!$result) { |
|
| 969 | throw new Exception('Batch insert error'); |
|
| 970 | } |
|
| 971 | } |
|
| 972 | ||
| 973 | return $this; |
|