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

Implement Collection::findOneAndUpdate()

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.1.0
    • Affects Version/s: 0.1.0
    • Component/s: None
    • None

      Note that the spec abstracts the new option (in the MongoDB command) as returnDocument, which is an enum with before and after values. These should probably be constants defined on either Collection or a ReturnDocument interface, or we can look at other design patterns for representing an enum in PHP (there are a few).

      Usage example:

      $collection->findOneAndUpdate(
          // Required criteria param
          ['x' => 1],
          // Required update param
          ['$set' => ['x' => 2]],
          // Optional named params in an associative array
          ['maxTimeMS' => 2000]
      );
      

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

              Created:
              Updated:
              Resolved: