You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found strange behavior in whereNot expression, when I did something like this -
use MongoDB\BSON\Regex;
$expression->whereNot((new Expression())->where('foo', new Regex('bar', '')))
I got error -
Can't have regex as arg to $ne
In code:
foreach ($expression->toArray() as $field => $value) {
// $not acceptable only for operators-expressions
if (is_array($value) && is_string(key($value))) {
$this->where($field, array('$not' => $value));
} // for single values use $ne
else {
$this->whereNotEqual($field, $value);
}
}
Maybe it makes sense to add a check for object, something like this?
if (is_array($value) && is_string(key($value)) || is_object($value)) {
The text was updated successfully, but these errors were encountered:
Hi,
I found strange behavior in whereNot expression, when I did something like this -
I got error -
In code:
Maybe it makes sense to add a check for object, something like this?
if (is_array($value) && is_string(key($value)) || is_object($value)) {
The text was updated successfully, but these errors were encountered: