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

testFindAndModifyRemove() public method

    public function testFindAndModifyRemove()
    {
        $id = '54203e08d51d4a1f868b456e';
        $collection = $this->getCollection();
        $document = ['_id' => new \MongoId($id), 'foo' => 'bar'];
        $collection->insert($document);
        $document = $collection->findAndModify(['_id' => new \MongoId($id)], null, null, ['remove' => true]);
        $this->assertEquals('bar', $document['foo']);
        $newCollection = $this->getCheckDatabase()->selectCollection('test');
        $this->assertSame(0, $newCollection->count());
    }
MongoCollectionTest