[英]find where with same attribute and more than 2 values in yii2 mongodb
I can count it with one ObjectId as shown below.我可以用一个 ObjectId 来计算它,如下所示。
public function count_typesA() {
$list = Shops::findAll(['typeid'=>new MongoDB\BSON\ObjectId("57eb8395b5ea6a14c00075d2")]);
return count($list);
}
I have to count all the typeid with 57ea5880b5ea6a0650002785
and 57eb8395b5ea6a14c00075d2
.我必须用
57ea5880b5ea6a0650002785
和57eb8395b5ea6a14c00075d2
计算所有 typeid 。 (Same attribute typeid
with different values) How to do it? (相同的属性
typeid
具有不同的值)怎么做?
Something like this could help:这样的事情可能会有所帮助:
public function count_typesA() {
$list = Shops::findAll(['typeid'=> [
new MongoDB\BSON\ObjectId("57eb8395b5ea6a14c00075d2"),
new MongoDB\BSON\ObjectId("57ea5880b5ea6a0650002785")
]
]);
return count($list);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.