@@ 152-161 (lines=10) @@ | ||
149 | * @param mixed|Expr $valueOrExpression |
|
150 | * @return $this |
|
151 | */ |
|
152 | public function addToSet($valueOrExpression) |
|
153 | { |
|
154 | if ($valueOrExpression instanceof Expr) { |
|
155 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
156 | } |
|
157 | ||
158 | $this->requiresCurrentField(); |
|
159 | $this->newObj['$addToSet'][$this->currentField] = $valueOrExpression; |
|
160 | return $this; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Specify $all criteria for the current field. |
|
@@ 995-1004 (lines=10) @@ | ||
992 | * @param mixed|Expr $valueOrExpression |
|
993 | * @return $this |
|
994 | */ |
|
995 | public function pull($valueOrExpression) |
|
996 | { |
|
997 | if ($valueOrExpression instanceof Expr) { |
|
998 | $valueOrExpression = $valueOrExpression->getQuery(); |
|
999 | } |
|
1000 | ||
1001 | $this->requiresCurrentField(); |
|
1002 | $this->newObj['$pull'][$this->currentField] = $valueOrExpression; |
|
1003 | return $this; |
|
1004 | } |
|
1005 | ||
1006 | /** |
|
1007 | * Remove all elements matching any of the given values from the current |
|
@@ 1041-1053 (lines=13) @@ | ||
1038 | * @param mixed|Expr $valueOrExpression |
|
1039 | * @return $this |
|
1040 | */ |
|
1041 | public function push($valueOrExpression) |
|
1042 | { |
|
1043 | if ($valueOrExpression instanceof Expr) { |
|
1044 | $valueOrExpression = array_merge( |
|
1045 | ['$each' => []], |
|
1046 | $valueOrExpression->getQuery() |
|
1047 | ); |
|
1048 | } |
|
1049 | ||
1050 | $this->requiresCurrentField(); |
|
1051 | $this->newObj['$push'][$this->currentField] = $valueOrExpression; |
|
1052 | return $this; |
|
1053 | } |
|
1054 | ||
1055 | /** |
|
1056 | * Specify $gte and $lt criteria for the current field. |