在 Phalcon\Mvc\Collection 中使用 mongo 运算符 $and
Use mongo operator $and in Phalcon\Mvc\Collection
我正在尝试将 MongoDB 的运算符 $and 应用于 Phalcon\Mvc\Collection,如下所示:
$documents = Staff::find( $condition);
数组 $条件 具有这样的“角色”:
$condition["role"] = [
"$regex" => "$somevalue",
"$and"=> [
'$ne' => "admin"
]
];
我收到这个错误
Can't canonicalize query: Bad Value: unknown operator: $and'
请帮我解决这个问题。
有没有更好的方法将多个条件应用到这个“role”?
$and
默认在 mongo 中隐含使用。我想 "$ne" => "admin"
就够了。
MongoDB provides an implicit AND operation when specifying a comma
separated list of expressions. Using an explicit AND with the $and
operator is necessary when the same field or operator has to be
specified in multiple expressions.
我正在尝试将 MongoDB 的运算符 $and 应用于 Phalcon\Mvc\Collection,如下所示:
$documents = Staff::find( $condition);
数组 $条件 具有这样的“角色”:
$condition["role"] = [
"$regex" => "$somevalue",
"$and"=> [
'$ne' => "admin"
]
];
我收到这个错误
Can't canonicalize query: Bad Value: unknown operator: $and'
请帮我解决这个问题。
有没有更好的方法将多个条件应用到这个“role”?
$and
默认在 mongo 中隐含使用。我想 "$ne" => "admin"
就够了。
MongoDB provides an implicit AND operation when specifying a comma separated list of expressions. Using an explicit AND with the $and operator is necessary when the same field or operator has to be specified in multiple expressions.