We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
伪代码:
<?php $insertMany = [ { _id: 1, qty: 20 }, { _id: 2, qty: 55 }, { _id: 2, qty: 30 }, { _id: 3, qty: 100}, { _id: 3, qty: 120}, { _id: 4, qty: 20}, { _id: 5, qty: 30} ]; try { $insertResult = $mongoTable->insertMany($insertMany, ['ordered' => false]); printf("Inserted %d document(s)\n", count($insertResult->getInsertedIDs())); } catch (ServiceException $e) { print_r($e->getMessage()); //output like: error 'error while executing mongo command: bulk write error: [{[{E11000 duplicate key error collection: db_aaa.t_table index: _id_ dup key: { _id: "2"}} {E11000 duplicate key error collection: db_aaa.t_table index: _id_ dup key: { _id: "3" }}]}, {<nil>}]' on 'Hyperf\GoTask\Relay\CoroutineSocketRelay' } catch (GoridgeException $e) { //other logic }
ordered是false的时候,会继续插入非重复的数据,但是ServiceException没有提供实际写入的数据,可靠性不好控制。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
伪代码:
ordered是false的时候,会继续插入非重复的数据,但是ServiceException没有提供实际写入的数据,可靠性不好控制。
The text was updated successfully, but these errors were encountered: