--TEST-- MongoDB\Driver\Manager::executeBulkWrite() update multiple documents with upsert --SKIPIF-- --FILE-- update( array('_id' => 1), array('$set' => array('x' => 1)), array('multi' => true, 'upsert' => true) ); $result = $manager->executeBulkWrite(NS, $bulk); echo "\n===> WriteResult\n"; printWriteResult($result); echo "\n===> Collection\n"; $cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array())); var_dump(iterator_to_array($cursor)); ?> ===DONE=== --EXPECTF-- ===> WriteResult server: %s:%d insertedCount: 0 matchedCount: 0 modifiedCount: 0 upsertedCount: 1 deletedCount: 0 upsertedId[0]: int(1) ===> Collection array(1) { [0]=> object(stdClass)#%d (2) { ["_id"]=> int(1) ["x"]=> int(1) } } ===DONE===