Skip to content

Commit 30444c7

Browse files
committed
Restore Collection::_massageFindAndModifyOptions()
This was inadvertently removed in 495e46d.
1 parent 719fd25 commit 30444c7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Collection.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,26 @@ protected function _massageAggregateOptions($options)
11591159
return $options;
11601160
}
11611161

1162+
/**
1163+
* Internal helper for massaging findandmodify options
1164+
* @internal
1165+
*/
1166+
final protected function _massageFindAndModifyOptions($options, $update = array())
1167+
{
1168+
$ret = array(
1169+
"sort" => $options["sort"],
1170+
"new" => isset($options["returnDocument"]) ? $options["returnDocument"] == self::FIND_ONE_AND_RETURN_AFTER : false,
1171+
"fields" => $options["projection"],
1172+
"upsert" => isset($options["upsert"]) ? $options["upsert"] : false,
1173+
);
1174+
if ($update) {
1175+
$ret["update"] = $update;
1176+
} else {
1177+
$ret["remove"] = true;
1178+
}
1179+
return $ret;
1180+
}
1181+
11621182
/**
11631183
* Constructs the Query Wire Protocol field 'flags' based on $options
11641184
* provided to other helpers

0 commit comments

Comments
 (0)