Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-344

"Command does not support non local read concern" on findAndModify query on replicasets

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.2
    • Affects Version/s: 1.3.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      - PHP 7.2.4
      - MongoDB v3.6.3
      - PHP MongoDB extension version 1.4.2
      - Mongo PHP Adapter by alcaeus/mongo-php-adapter

      If I perform a findAndModify query on a replicaset, and a readConcern is set "majority" on instantiation of the MongoClient, an exception is thrown: "Command does not support non local read concern".

      Steps to reproduce:

      $mongoClient = new \MongoClient("mongodb://127.0.0.1:27019,127.0.0.1:27020,127.0.0.1:27021/?readConcernLevel=majority");
              $collection = $mongoClient->testdb->user;
              $collection->findAndModify(
                  array('_id' => new MongoId('55d445973e019c996c78b08e')),
                  array('$set' => array('test' => 'success'))
              );
      

      The mongoDB function "findAndModify" supports only "local" readConcerns. However, the mongo-php-library uses the readConcern from the server string in the constructor in the MongoClient class.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            Chris-Pl Christian Pletz [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: