Mongo DB $or query in PHP

后端 未结 1 1630
一生所求
一生所求 2021-02-04 04:26

I can\'t figure out for the life of my to select from a collection with the or parameter. It\'s not working at all for me and I can\'t really find any documentation

相关标签:
1条回答
  • 2021-02-04 04:50
    The $or operator lets you use boolean or in a query.
    You give $or an array of expressions, any of which can satisfy the query.
    

    You provided only one element in the array. Use:

    find(array('$or' => array(
      array("brand" => "anti-clothes"),
      array("allSizes" => "small")
    )));
    
    0 讨论(0)
提交回复
热议问题