Skip to content

Commit e7a385a

Browse files
authored
Fix when the value is numeric in where like
1 parent a362df4 commit e7a385a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Jenssegers/Mongodb/Query/Builder.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@ protected function compileWhereAll(array $where)
993993
protected function compileWhereBasic(array $where)
994994
{
995995
extract($where);
996-
$is_numeric = false;
997996

998997
// Replace like or not like with a Regex instance.
999998
if (in_array($operator, ['like', 'not like'])) {
@@ -1019,7 +1018,6 @@ protected function compileWhereBasic(array $where)
10191018
$plain_value = Str::replaceLast('%', null, $plain_value);
10201019
}
10211020

1022-
$is_numeric = is_numeric($plain_value);
10231021
$value = new Regex($regex, 'i');
10241022
} // Manipulate regexp operations.
10251023
elseif (in_array($operator, ['regexp', 'not regexp', 'regex', 'not regex'])) {
@@ -1039,11 +1037,7 @@ protected function compileWhereBasic(array $where)
10391037
}
10401038

10411039
if (!isset($operator) || $operator == '=') {
1042-
if ($is_numeric) {
1043-
$query = ['$where' => '/^'.$value->getPattern().'/.test(this.'.$column.')'];
1044-
} else {
1045-
$query = [$column => $value];
1046-
}
1040+
$query = [$column => $value];
10471041
} elseif (array_key_exists($operator, $this->conversion)) {
10481042
$query = [$column => [$this->conversion[$operator] => $value]];
10491043
} else {

0 commit comments

Comments
 (0)