MongoDB Connection From PHP

By Authenticate User : 
$user = 'testUser';
$pass = '123456';
$connection = new MongoClient("mongodb://${user}:${pass}@localhost", array("db" => "testDB"));


Without Authenticate User:

$host = 'localhost';
$nidCollection = 'nids';
$connection = new MongoClient("mongodb://{$host}");
$db = $connection->nidservice;

$COLL_nid = $db->$nidCollection;

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine