Last active
December 8, 2015 06:36
-
-
Save metanav/ace4e5de7aecd556c5a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ab = $this->dm->getDocumentCollection('Document\Test')->createAggregationBuilder(); | |
if (is_array($filter)) { | |
/* Here $filter is an array which could be $qb->getQuery()->getQuery()['query'] | |
* or manually crafted | |
* example [ '$and' => [ 'name' => 'keyword'] ] | |
*/ | |
$ab->match(); // <-- how to pass query array to match stage? | |
} else { | |
$ab->match()->text($filter); | |
} | |
// more complex things like group, redact, sort are happening and aggregation builder does really well here | |
$results = $ab->execute(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment