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: 2021-08-03 11:40 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: cmb (profile)
Status: Closed 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
 [2021-08-03 11:40 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-08-03 11:40 UTC] cmb@php.net
The documentation of the mongo package has been removed from the
manual, because the mongo package is superseeded by the mongodb
package for years.  This ticket is obsolete.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 03:01:33 2024 UTC