|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67964 MongoCollection::batchInsert error in example
Submitted: 2014-09-05 09:50 UTC Modified: 2017-01-28 12:37 UTC
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: pau at rullan dot cat Assigned:
Status: Open Package: mongo (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
16 + 28 = ?
Subscribe to this entry?

 [2014-09-05 09:50 UTC] pau at rullan dot cat
The MongoCollection::batchInsert method raises a MongoDuplicateKeyException even while using the continueOnError flag. This affects the example because there is no try catch construct.

In the test script form I show a simple correction.

Test script:
$con = new MongoClient;
// rest of the code
$c = $db->selectCollection('c');
try {
    array($doc1, $doc2, $doc3, $doc4),
    array('continueOnError' => true)
} catch(MongoDuplicateKeyException $e) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-28 12:37 UTC]
-Package: Documentation problem +Package: mongo
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 11 08:01:23 2021 UTC