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