I'm actually working on a web server, I need to look for CardNumber
in my client
collection.
In order to do that, I get all the Bills
where I can find my CardNumber
The problem is : in Bills
, CardNumber
are Int64 , but in client
, CardNumber
are double . In PHP my query doesn't work, but when i'm doing it on mongo it works.
Here is my code
foreach ($this->bills as $bill)
{
$query = [
//Already tried to cast, floatvar etc...
'CARDNUM' => doublevar(($bill['CARDNUM']))
];
$result = $collection->findOne($query);
var_dump($result); //Always null
}
For exemple, my first $bill['CARDNUM']
gives me 0123456
If I do this db.getCollection('clientCollec').find({"CARDNUM" : 0123456})
in a mongoShell, I have a result.
Thanks for helping
发现我的问题,错误是我的代码中clientCollec
的名称...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.