@@ 829-835 (lines=7) @@ | ||
826 | // If the w parameter is set to acknowledge the write, |
|
827 | // returns an associative array with the status of the inserts ("ok") |
|
828 | // and any error that may have occurred ("err"). |
|
829 | if(is_array($result)) { |
|
830 | if($result['ok'] != 1) { |
|
831 | throw new Exception('Batch insert error: ' . $result['err']); |
|
832 | } |
|
833 | ||
834 | return $this; |
|
835 | } |
|
836 | ||
837 | // Otherwise, returns TRUE if the batch insert was successfully sent, |
|
838 | // FALSE otherwise. |
|
@@ 902-907 (lines=6) @@ | ||
899 | ); |
|
900 | ||
901 | // if write concern acknowledged |
|
902 | if(is_array($result)) { |
|
903 | if($result['ok'] != 1) { |
|
904 | throw new Exception(sprintf('Update error: %s: %s', $result['err'], $result['errmsg'])); |
|
905 | } |
|
906 | return $this; |
|
907 | } |
|
908 | ||
909 | // if write concern unacknowledged |
|
910 | if(!$result) { |
@@ 944-950 (lines=7) @@ | ||
941 | $result = $targetMongoCollection->batchInsert($documentList); |
|
942 | ||
943 | // check result |
|
944 | if(is_array($result)) { |
|
945 | if($result['ok'] != 1) { |
|
946 | throw new Exception('Batch insert error: ' . $result['err']); |
|
947 | } |
|
948 | } elseif(!$result) { |
|
949 | throw new Exception('Batch insert error'); |
|
950 | } |
|
951 | } |
|
952 | ||
953 | return $this; |