Skip to content

MongoDB\Driver\Exception\BulkWriteException on insert not documented #229

@jacobweber

Description

@jacobweber

If I have a collection with an indexed field, and I call insertOne to try to insert a duplicate value in that field, I get a BulkWriteException:

class MongoDB\Driver\Exception\BulkWriteException#197 (9) {
  protected $message =>
  string(126) "insertDocument :: caused by :: 11000 E11000 duplicate key error index: STF.preferences.$sviUserId_1  dup key: { : "00090A19" }"
...

Shouldn't this throw one of the exceptions from this library, or an InsertOneResult? The documentation doesn't say that this function can throw an exception.

Using mongodb extension 1.1.8, PHP library 1.0.2, PHP 5.4.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions