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;
$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
Post a Comment