Alcaeus\MongoDbAdapter\Tests\Mongo\MongoCollectionTest::testUpdateMany PHP Method

testUpdateMany() public method

public testUpdateMany ( )
    public function testUpdateMany()
    {
        $document = ['change' => true, 'foo' => 'bar'];
        $this->getCollection()->insert($document);
        unset($document['_id']);
        $this->getCollection()->insert($document);
        $document = ['change' => true, 'foo' => 'foo'];
        $this->getCollection()->insert($document);
        $expected = ['ok' => 1.0, 'nModified' => 2, 'n' => 3, 'err' => null, 'errmsg' => null, 'updatedExisting' => true];
        $result = $this->getCollection()->update(['change' => true], ['$set' => ['foo' => 'foo']], ['multiple' => true]);
        $this->assertSame($expected, $result);
        $this->assertSame(3, $this->getCheckDatabase()->selectCollection('test')->count(['foo' => 'foo']));
    }
MongoCollectionTest