I have this record in DB
{
"_id": ObjectId("5759ccbcc2b503980c000143"),
"phone": "516-425-5878",
"orders": [
"1338475681",
"1891805481",
"1891805481"
]
}
Here is my code.
$collection = $mongo_db_obj->selectCollection('scrapers', 'leads');
$data = array(
'phone' => '516-425-5878',
"orders" => array('$in'=>1891805481)
);
$doc = $collection->findOne($data);
dump($doc);
I want to check if particular phone
and and order id inside orders
array exists or not. But my code is giving error.
I have tried this one too.
$data = array(
'phone' => '516-425-5878',
"orders" => array(1891805481)
);
But it returns empty results.
How do I check that?