使用旧的旧版驱动程序时,它看起来像:
<?php
$cursor = $collection
->find
(
array( '$text' => array( '$search' => 'some text' ) ),
array( 'score' => array( '$meta' => 'textScore') )
)
->sort( array( '$meta' => 'textScore') );
如何使用新的MongoDB PHP库https://github.com/mongodb/mongo-php-library做同样的事情?
<?php
$cursor = $collection->find(
[ '$text' => [ '$search' => 'some text' ] ],
[ 'sort' => ... ]
);