Last active
April 16, 2021 22:45
-
-
Save ederrafo/be8721e240d641a44b87b4dba74f78a0 to your computer and use it in GitHub Desktop.
php php7 mongo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const MONGODB = "mongodb://localhost:27017"; | |
$mongo = new MongoDB\Driver\Manager(MONGODB); | |
$query = new MongoDB\Driver\Query([], []); | |
$cursor = $mongo->executeQuery('payments.paymentOrder', $query); | |
$posts = []; | |
foreach ($cursor as $document) { | |
array_push($posts, json_decode(MongoDB\BSON\toJSON(MongoDB\BSON\fromPHP($document)))); | |
} | |
echo __FILE__." on line ".__LINE__,": "; print_r($posts); echo "\n"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment