@@ 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) { |
@@ 935-941 (lines=7) @@ | ||
932 | $result = $targetMongoCollection->batchInsert($documentList); |
|
933 | ||
934 | // check result |
|
935 | if(is_array($result)) { |
|
936 | if($result['ok'] != 1) { |
|
937 | throw new Exception('Batch insert error: ' . $result['err']); |
|
938 | } |
|
939 | } elseif(!$result) { |
|
940 | throw new Exception('Batch insert error'); |
|
941 | } |
|
942 | } |
|
943 | ||
944 | return $this; |