我已经在mongo终端中使用了这个查询命令,它与scor sort一起工作
db.stores.createIndex( { name: "text", description: "text" } )
db.articles.find( { $text: { $search: "coffee" } } )
这个查询是在我的终端上的mongo上工作的我做了:
$collection = Yii::$app->mongodb->getCollection('mydata');
$result = $collection->find([
[
'$text' => [
'$search' => $key,
]
]
]);
查询在mongo终端上运行良好,我是从以下位置复制的:https://docs.mongodb.com/manual/reference/operator/query/text/
我得到的错误:
TypeError
strtoupper(): Argument #1 ($string) must be of type string, array given
1条答案
按热度按时间t8e9dugd1#
我自己没有用过mongodb和Yii,但是我认为你在数组上做得太深了。