php.net |  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
Votes:3
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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pau at rullan dot cat
New email:
PHP Version: OS:

 

 [2014-09-05 09:50 UTC] pau at rullan dot cat
Description:
------------
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 {
$c->batchInsert(
    array($doc1, $doc2, $doc3, $doc4),
    array('continueOnError' => true)
);
} catch(MongoDuplicateKeyException $e) {
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-28 12:37 UTC] cmb@php.net
-Package: Documentation problem +Package: mongo
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Mar 01 10:01:23 2021 UTC