| @@ 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; |
|
| @@ 831-837 (lines=7) @@ | ||
| 828 | // If the w parameter is set to acknowledge the write, |
|
| 829 | // returns an associative array with the status of the inserts ("ok") |
|
| 830 | // and any error that may have occurred ("err"). |
|
| 831 | if(is_array($result)) { |
|
| 832 | if($result['ok'] != 1) { |
|
| 833 | throw new Exception('Batch insert error: ' . $result['err']); |
|
| 834 | } |
|
| 835 | ||
| 836 | return $this; |
|
| 837 | } |
|
| 838 | ||
| 839 | // Otherwise, returns TRUE if the batch insert was successfully sent, |
|
| 840 | // FALSE otherwise. |
|
| @@ 904-909 (lines=6) @@ | ||
| 901 | ); |
|
| 902 | ||
| 903 | // if write concern acknowledged |
|
| 904 | if(is_array($result)) { |
|
| 905 | if($result['ok'] != 1) { |
|
| 906 | throw new Exception(sprintf('Update error: %s: %s', $result['err'], $result['errmsg'])); |
|
| 907 | } |
|
| 908 | return $this; |
|
| 909 | } |
|
| 910 | ||
| 911 | // if write concern unacknowledged |
|
| 912 | if(!$result) { |
|