[英]$in doesn't work inside $or in MONGO CAKEPHP
Hi I have a query where $in is to be used inside $or because there are two set of conditions. 嗨,我有一个查询,其中在$ in中使用$ in或因为有两组条件。
(
[conditions] => Array
(
[$or] => Array
(
[0] => Array
(
[id] => Array
(
[$in] => Array
(
[0] => 53fc47ee6eb2361111ba4364
[1] => 53fc48336eb2361311ba4360
[2] => 53fc48716eb2361411ba4360
)
)
)
)
)
)
It is giving me an empty result but if skip $or and directly use id under conditions it will give me desired result. 它给了我一个空的结果,但是如果跳过$ or并在条件下直接使用id,它将给我想要的结果。 Following format is working fine.
以下格式工作正常。 But as you know i need $or for second set of conditions.
但是如您所知,第二组条件需要$或。
(
[conditions] => Array
(
[id] => Array
(
[$in] => Array
(
[0] => 53fc47ee6eb2361111ba4364
[1] => 53fc48336eb2361311ba4360
[2] => 53fc48716eb2361411ba4360
)
)
)
)
Again, I need $or because I need to have two set of conditions inside or. 同样,我需要$ or,因为我需要在or内有两组条件。 I only displayed one here.
我只在这里展示了一个。
I am using ICHIKAWAY CAKEPHP MONGO Plugin. 我正在使用ICHIKAWAY CAKEPHP MONGO插件。
Please help !!! 请帮忙 !!!
Use $in
in ICHIKAWAY CAKEPHP MONGO Plugin: 在ICHIKAWAY CAKEPHP MONGO插件中使用
$in
:
$this->paginate = array('conditions' => array(
'category' => array('$in'=>array('123', 'a', 'abc')))
);
Above code will select all categories in array('123', 'a', 'abc')
上面的代码将选择
array('123', 'a', 'abc')
所有类别array('123', 'a', 'abc')
I hope this will help 我希望这个能帮上忙
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.