So I want to get the object id from the mongodb using foreach loop.How can I achieve that?
$cursor2 = $videoCollection->find(['$text' => ['$search' => 'C:/Users/']]);
$cursorArray = json_decode(json_encode($cursor2->toArray(),true));
foreach ($cursorArray as $key=>$document) {
print_r($document->_id);
}
How can I get the Object Id from this?
[_id] => stdClass Object
(
[$oid] => 6246c1c3b5ad6657936980b3
)