Doctrine\MongoDB\Tests\Query\BuilderTest::testSortMetaDoesProjectMissingField PHP Method

testSortMetaDoesProjectMissingField() public method

    public function testSortMetaDoesProjectMissingField()
    {
        $qb = $this->getTestQueryBuilder()->select('score')->sortMeta('score', 'textScore');
        /* This will likely yield a server error, but sortMeta() should only set
         * the projection if it doesn't already exist.
         */
        $this->assertEquals(['score' => 1], $qb->debug('select'));
        $this->assertEquals(['score' => ['$meta' => 'textScore']], $qb->debug('sort'));
    }
BuilderTest