| @@ 171-180 (lines=10) @@ | ||
| 168 | * @param mixed|Expr $valueOrExpression |
|
| 169 | * @return $this |
|
| 170 | */ |
|
| 171 | public function addToSet($valueOrExpression) |
|
| 172 | { |
|
| 173 | if ($valueOrExpression instanceof Expr) { |
|
| 174 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
| 175 | } |
|
| 176 | ||
| 177 | $this->requiresCurrentField(); |
|
| 178 | $this->newObj['$addToSet'][$this->currentField] = $valueOrExpression; |
|
| 179 | return $this; |
|
| 180 | } |
|
| 181 | ||
| 182 | /** |
|
| 183 | * Specify $all criteria for the current field. |
|
| @@ 1012-1021 (lines=10) @@ | ||
| 1009 | * @param mixed|Expr $valueOrExpression |
|
| 1010 | * @return $this |
|
| 1011 | */ |
|
| 1012 | public function pull($valueOrExpression) |
|
| 1013 | { |
|
| 1014 | if ($valueOrExpression instanceof Expr) { |
|
| 1015 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
| 1016 | } |
|
| 1017 | ||
| 1018 | $this->requiresCurrentField(); |
|
| 1019 | $this->newObj['$pull'][$this->currentField] = $valueOrExpression; |
|
| 1020 | return $this; |
|
| 1021 | } |
|
| 1022 | ||
| 1023 | /** |
|
| 1024 | * Remove all elements matching any of the given values from the current |
|
| @@ 1058-1070 (lines=13) @@ | ||
| 1055 | * @param mixed|Expr $valueOrExpression |
|
| 1056 | * @return $this |
|
| 1057 | */ |
|
| 1058 | public function push($valueOrExpression) |
|
| 1059 | { |
|
| 1060 | if ($valueOrExpression instanceof Expr) { |
|
| 1061 | $valueOrExpression = array_merge( |
|
| 1062 | ['$each' => []], |
|
| 1063 | $valueOrExpression->getQuery() |
|
| 1064 | ); |
|
| 1065 | } |
|
| 1066 | ||
| 1067 | $this->requiresCurrentField(); |
|
| 1068 | $this->newObj['$push'][$this->currentField] = $valueOrExpression; |
|
| 1069 | return $this; |
|
| 1070 | } |
|
| 1071 | ||
| 1072 | /** |
|
| 1073 | * Specify $gte and $lt criteria for the current field. |
|