diff --git a/src/Jenssegers/Mongodb/Query/Builder.php b/src/Jenssegers/Mongodb/Query/Builder.php index 736ce2629..f3bec62e3 100644 --- a/src/Jenssegers/Mongodb/Query/Builder.php +++ b/src/Jenssegers/Mongodb/Query/Builder.php @@ -491,6 +491,24 @@ public function orderBy($column, $direction = 'asc') return $this; } + /** + * Add a "where all" clause to the query. + * + * @param string $column + * @param array $values + * @param string $boolean + * @param bool $not + * @return $this + */ + public function whereAll($column, array $values, $boolean = 'and', $not = false) + { + $type = 'all'; + + $this->wheres[] = compact('column', 'type', 'boolean', 'values', 'not'); + + return $this; + } + /** * @inheritdoc */ @@ -923,6 +941,17 @@ protected function compileWheres() return $compiled; } + /** + * @param array $where + * @return array + */ + protected function compileWhereAll(array $where) + { + extract($where); + + return [$column => ['$all' => array_values($values)]]; + } + /** * @param array $where * @return array