Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-360

Duplicate key error when executing a BulkWrite with insertions multiple times

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.6.3
    • Component/s: None
    • None

      Failing test case:

      --TEST--
      MongoDB\Driver\Manager::executeBulkWrite() multiple times with same BulkWrite
      --SKIPIF--
      <?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
      --FILE--
      <?php
      require_once __DIR__ . "/../utils/basic.inc";
      
      $manager = new MongoDB\Driver\Manager(STANDALONE);
      
      $document = (object) array('x' => 0);
      
      $bulk = new MongoDB\Driver\BulkWrite();
      $bulk->insert($document);
      
      $result = $manager->executeBulkWrite(NS, $bulk);
      var_dump($result->isAcknowledged());
      var_dump($result->getInsertedCount());
      
      $result = $manager->executeBulkWrite(NS, $bulk);
      var_dump($result->isAcknowledged());
      var_dump($result->getInsertedCount());
      
      ?>
      ===DONE===
      <?php exit(0); ?>
      --EXPECT--
      ===> WriteResult
      bool(true)
      int(1)
      bool(true)
      int(1)
      ===DONE===
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: