updateAll() public method

Update all documents
Deprecation: since 1.13. Use Collection::batchUpdate([])
public updateAll ( Operator | array | callable $updateData ) : Collection
$updateData Operator | array | callable new data or operators
return Collection
Example #1
0
 /**
  * @expectedException \Sokil\Mongo\Exception
  * @expectedExceptionMessage Update error
  */
 public function testUpdateAll_ErrorWithUnacknowledgedWriteConcern()
 {
     // mock mongo's collection
     $mongoCollectionMock = $this->getMock('\\MongoCollection', array('update'), array($this->database->getMongoDB(), 'phpmongo_test_collection'));
     $mongoCollectionMock->expects($this->once())->method('update')->with($this->isType('array'), $this->isType('array'), $this->arrayHasKey('multiple'))->will($this->returnValue(false));
     // create collection with mocked original mongo collection
     $this->collection = new Collection($this->database, $mongoCollectionMock);
     $this->collection->setUnacknowledgedWriteConcern();
     $this->collection->updateAll(new Operator());
 }