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
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 !
Your email address:
MUST BE VALID
Solve the problem:
40 - 34 = ?
Subscribe to this entry?

 
 [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: Sat Apr 20 01:01:28 2024 UTC