Skip to content

Incorrect behavior of BulkWrite::count() #429

@petr-buchin

Description

@petr-buchin

Environment:

Ubuntu 16.04 / Linux Mint 18 "Sarah"

mongodb support => enabled
mongodb version => 1.1.8
mongodb stability => stable
libmongoc version => 1.3.5
libbson version => 1.3.5

Test script:

<?php

$documents = [
    ['one'   => 1],
    ['two'   => 2],
    ['three' => 3],
    ['four'  => 4],
    ['five'  => 5],
];

$bulk = new \MongoDB\Driver\BulkWrite;

foreach ($documents as $doc) {
    $bulk->insert($doc);
    echo $bulk->count(), PHP_EOL;
}

Expected result:

1
2
3
4
5

Actual result:

1
1
1
1
1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions