@@ 791-797 (lines=7) @@ | ||
788 | // If the w parameter is set to acknowledge the write, |
|
789 | // returns an associative array with the status of the inserts ("ok") |
|
790 | // and any error that may have occurred ("err"). |
|
791 | if(is_array($result)) { |
|
792 | if($result['ok'] != 1) { |
|
793 | throw new Exception('Batch insert error: ' . $result['err']); |
|
794 | } |
|
795 | ||
796 | return $this; |
|
797 | } |
|
798 | ||
799 | // Otherwise, returns TRUE if the batch insert was successfully sent, |
|
800 | // FALSE otherwise. |
|
@@ 864-869 (lines=6) @@ | ||
861 | ); |
|
862 | ||
863 | // if write concern acknowledged |
|
864 | if(is_array($result)) { |
|
865 | if($result['ok'] != 1) { |
|
866 | throw new Exception(sprintf('Update error: %s: %s', $result['err'], $result['errmsg'])); |
|
867 | } |
|
868 | return $this; |
|
869 | } |
|
870 | ||
871 | // if write concern unacknowledged |
|
872 | if(!$result) { |
@@ 892-898 (lines=7) @@ | ||
889 | $result = $targetMongoCollection->batchInsert($documentList); |
|
890 | ||
891 | // check result |
|
892 | if(is_array($result)) { |
|
893 | if($result['ok'] != 1) { |
|
894 | throw new Exception('Batch insert error: ' . $result['err']); |
|
895 | } |
|
896 | } elseif(!$result) { |
|
897 | throw new Exception('Batch insert error'); |
|
898 | } |
|
899 | } |
|
900 | ||
901 | return $this; |