如何使用Doctrine查询构建器构建下面的本机mongo db查询?
db.Product.find({
$text: {$search: 'CaSe InSEnsitive'},
title: {$regex:/^CaSe InSEnsitive$/i}
});
此查询将使用文本搜索索引加速不区分大小写的搜索!
答案 0 :(得分:1)
$expr = $query->expr()->operator('$text', array(
'$search' => $param['title'],
'$language' => 'en', // or one of those other languages
));
$query->field(null)->equals($expr->getQuery());