I am having a problem trying to execute a simple find method using $lt
. i.e. Fetch rows where Id
is less than 5. Simple
Below is my query:
$result = $collection->find($data);
Where $data
is:
[id] => Array
(
[$lt] => 5
)
But as a result, I am getting the Id
, But it compares only the first digit.
Returning Ids are:
[{"_id":{"$oid":"615839a18ffb730a922af032"},"id":"1"},
{"_id":{"$oid":"615839a18ffb730a922af033"},"id":"2"},
{"_id":{"$oid":"615839a18ffb730a922af039"},"id":"15"}
{"_id":{"$oid":"615839a18ffb730a922af039"},"id":"45"}
Why it is comparing only First Digit of Id
. Why $lt
not working on the whole Id
?
I am getting Ids 1,2,14,45,466 etc. All the first digit starts less than 5. But want the result less than 5 instead of the First digit.