PHP code example of mtrbean / mongo-json

1. Go to this page and download the library: Download mtrbean/mongo-json library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mtrbean / mongo-json example snippets




$doc = array("dt" => new MongoDate);
echo MongoJson::strict($doc);

$doc = array("dt" => new MongoDate);
echo MongoJson::extended($doc);

$doc = array("_id" => new MongoId, "regex" => new MongoRegex('/^acme.*corp/i'));
echo MongoJson::extended($doc, JSON_PRETTY_PRINT); // will prettify the JSON string