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

testFindAndModifyUpdateWithUpdateOptions() public method

    public function testFindAndModifyUpdateWithUpdateOptions()
    {
        $id = '54203e08d51d4a1f868b456e';
        $collection = $this->getCollection();
        $document = ['_id' => new \MongoId($id), 'foo' => 'bar'];
        $collection->insert($document);
        $document = $collection->findAndModify(['_id' => new \MongoId($id)], [], [], ['update' => ['bar' => 'foo']]);
        $this->assertSame('bar', $document['foo']);
        $newCollection = $this->getCheckDatabase()->selectCollection('test');
        $this->assertSame(1, $newCollection->count());
        $object = $newCollection->findOne();
        $this->assertNotNull($object);
        $this->assertAttributeSame('foo', 'bar', $object);
        $this->assertObjectNotHasAttribute('foo', $object);
    }
MongoCollectionTest