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