| @@ 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; |
|
| @@ 796-802 (lines=7) @@ | ||
| 793 | // If the w parameter is set to acknowledge the write, |
|
| 794 | // returns an associative array with the status of the inserts ("ok") |
|
| 795 | // and any error that may have occurred ("err"). |
|
| 796 | if(is_array($result)) { |
|
| 797 | if($result['ok'] != 1) { |
|
| 798 | throw new Exception('Batch insert error: ' . $result['err']); |
|
| 799 | } |
|
| 800 | ||
| 801 | return $this; |
|
| 802 | } |
|
| 803 | ||
| 804 | // Otherwise, returns TRUE if the batch insert was successfully sent, |
|
| 805 | // FALSE otherwise. |
|
| @@ 869-874 (lines=6) @@ | ||
| 866 | ); |
|
| 867 | ||
| 868 | // if write concern acknowledged |
|
| 869 | if(is_array($result)) { |
|
| 870 | if($result['ok'] != 1) { |
|
| 871 | throw new Exception(sprintf('Update error: %s: %s', $result['err'], $result['errmsg'])); |
|
| 872 | } |
|
| 873 | return $this; |
|
| 874 | } |
|
| 875 | ||
| 876 | // if write concern unacknowledged |
|
| 877 | if(!$result) { |
|