Skip to content

Command does not support writeConcern with wire version 4 #967

@timwhitlock

Description

@timwhitlock

Description

After upgrading the driver to any 1.5.x version, write commands give me an error like this:

"insert" command does not support writeConcern with wire version 4, wire version 5 is required

Version 1.4.4 works fine using v1.9.4 of the C library. Same code, same server.

Environment

MongoDB server version is 3.2.22 using mmapv1 storage engine.

Happens with drivers 1.5.0 through 1.5.3 using bundled versions of libmongoc 1.11.0 through 1.13.0 respectively.

Same results on Mac (built from source) and CentOS (Remi repo).
PHP version is 7.2.16.

Test Script

$manager = new MongoDB\Driver\Manager( 'mongodb://localhost:27017', [
    'username' => 'foo',
    'password' => 'bar',
    'authSource' => 'admin',
] );

$cursor = $manager->executeWriteCommand( 'test', new MongoDB\Driver\Command( [
    'insert' => 'test',
    'documents' => [ [ 'time' => new MongoDB\BSON\UTCDateTime ] ],
] ), [
    'writeConcern' => new MongoDB\Driver\WriteConcern( 1, 5000, true ),
] );

Expected and Actual Behavior

Throws MongoDB\Driver\Exception\RuntimeException: "insert" command does not support writeConcern with wire version 4, wire version 5 is required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions