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)) {
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)) {