test mongo
This commit is contained in:
@@ -6,6 +6,7 @@ class Home extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->mongoDbTest();
|
||||
$data['envID'] = getenv('ENV_ID');
|
||||
$data['home_background'] = getenv('HOME_PAGE_BACKGROUND');
|
||||
return view('welcome_message',$data);
|
||||
@@ -18,5 +19,17 @@ class Home extends BaseController
|
||||
}
|
||||
public function mongoDbTest(){
|
||||
$client = new \MongoDB("mongodb://chiefsoft:may12002@10.0.0.32:27017/","mongoClient");
|
||||
|
||||
try {
|
||||
// Send a ping to confirm a successful connection
|
||||
$client->selectDatabase('admin')->command(['ping' => 1]);
|
||||
echo "Pinged your deployment. You successfully connected to MongoDB!\n";
|
||||
} catch (Exception $e) {
|
||||
printf($e->getMessage());
|
||||
}
|
||||
|
||||
//$client->createDBRef()
|
||||
// $currDb = $client->createCollection("traffic");
|
||||
//$currDb->insert()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user