| @@ 174-183 (lines=10) @@ | ||
| 171 | * @param mixed|Expr $valueOrExpression |
|
| 172 | * @return $this |
|
| 173 | */ |
|
| 174 | public function addToSet($valueOrExpression) |
|
| 175 | { |
|
| 176 | if ($valueOrExpression instanceof Expr) { |
|
| 177 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
| 178 | } |
|
| 179 | ||
| 180 | $this->requiresCurrentField(); |
|
| 181 | $this->newObj['$addToSet'][$this->currentField] = $valueOrExpression; |
|
| 182 | return $this; |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Specify $all criteria for the current field. |
|
| @@ 1023-1032 (lines=10) @@ | ||
| 1020 | * @param mixed|Expr $valueOrExpression |
|
| 1021 | * @return $this |
|
| 1022 | */ |
|
| 1023 | public function pull($valueOrExpression) |
|
| 1024 | { |
|
| 1025 | if ($valueOrExpression instanceof Expr) { |
|
| 1026 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
| 1027 | } |
|
| 1028 | ||
| 1029 | $this->requiresCurrentField(); |
|
| 1030 | $this->newObj['$pull'][$this->currentField] = $valueOrExpression; |
|
| 1031 | return $this; |
|
| 1032 | } |
|
| 1033 | ||
| 1034 | /** |
|
| 1035 | * Remove all elements matching any of the given values from the current |
|
| @@ 1069-1081 (lines=13) @@ | ||
| 1066 | * @param mixed|Expr $valueOrExpression |
|
| 1067 | * @return $this |
|
| 1068 | */ |
|
| 1069 | public function push($valueOrExpression) |
|
| 1070 | { |
|
| 1071 | if ($valueOrExpression instanceof Expr) { |
|
| 1072 | $valueOrExpression = array_merge( |
|
| 1073 | ['$each' => []], |
|
| 1074 | $valueOrExpression->getQuery() |
|
| 1075 | ); |
|
| 1076 | } |
|
| 1077 | ||
| 1078 | $this->requiresCurrentField(); |
|
| 1079 | $this->newObj['$push'][$this->currentField] = $valueOrExpression; |
|
| 1080 | return $this; |
|
| 1081 | } |
|
| 1082 | ||
| 1083 | /** |
|
| 1084 | * Append multiple values to the current array field. |
|