Suppose there is a collection
{ "_id": ObjectId("588719a68996d3b21e8a1b8a"), "key1": "1a", "key2": "2a", "key3": "3a, "data": "1485248934" } { "_id": ObjectId("588719a68996d3b21e8a096d"), "key1": "1b", "key2": "2b", "key3": "3b, "data": "1485248000" } { "_id": ObjectId("588719a68996d3b21e8a4d57"), "key1": "1a", "key2": "2b", "key3": "3c", "data": "1485248555" } So I will select the necessary documents for one request.
$key1="1a"; $key2="2b"; $cond=array("key"=> array('$in' => array($key1, $key2))); $list = $collection->find($cond); В выборку у меня попадут все три документа. Attention question! How to build approximately the same query to select all documents that have
$ key1 = "1a" or "1b"; and $ key3 = "3b" or "3c"; (Ie, only the second and third documents will be included in the sample.)
PS The answer in PHP format is welcomed in every possible way, but not required.