I am using PHP to connect with MongoDB. My code is as follows.
// connect $m = new MongoClient($con_string); // connect to a remote host at a given port $db = $m->main; $customers = $db->customer->find();
i want to return $customers collection as json document to my HTML. How can i do this?
You can do this two ways:
or you can manually scroll through it:
Each of MongoDBs objects should have their
__toString()methods correctly implemented to bring back the representation of the value.