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

BulkWrite and executeInsert() should support an options array

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.0.0-rc0
    • Affects Version/s: 1.0.0-beta1
    • Component/s: None
    • None

      executeUpdate() and executeDelete() currently take an options array (between the query arguments and WriteConcern); however, executeBulkWrite() and executeInsert() do not and BulkWrite's constructor only takes a boolean $ordered argument.

      Current protos:

      • public function Manager::executeBulkWrite(string $namespace, BulkWrite $bulk, ?WriteConcern $writeConcern = null): WriteResult
      • public function Manager::executeInsert(string $namespace, mixed $document, ?WriteConcern $writeConcern = null): WriteResult
      • public function BulkWrite::__construct(boolean $ordered)

      This leaves no way to support a "bypassDocumentValidation" option at the basic driver level. We will need to change these prototypes to allow passing of such an option (and perhaps others down the line). Since we can create a BulkWrite with options, there is no need to change executeBulkWrite().

      Proposed protos:

      • public function Manager::executeInsert(string $namespace, mixed $document, ?array $insertOptions = [], ?WriteConcern $writeConcern = null): WriteResult
      • public function BulkWrite::__construct(?array $bulkWriteOptions = [])

      Actually implementation of "bypassDocumentValidation" will be handled by PHPC-443. This issue only pertains to modifying our public API to support an options array, to which we'll later add "bypassDocumentValidation".

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

              Created:
              Updated:
              Resolved: