-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
31 lines (30 loc) · 1 KB
/
config.php
File metadata and controls
31 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
// require 'vendor/autoload.php';
// $collection = (new MongoDB\Client)->test->users;
//
// $insertOneResult = $collection->insertOne([
// 'username' => 'admin',
// 'email' => 'admin@example.com',
// 'name' => 'Admin User',
// ]);
//
// printf("Inserted %d document(s)\n", $insertOneResult->getInsertedCount());
//
// var_dump($insertOneResult->getInsertedId());
?>
<?php
/*************************************************************************/
/****** This file will be used in all files for connection to MongoDB ******/
require 'vendor/autoload.php' ;
$client = new MongoDB\Client("mongodb://localhost:27017");
/****** Database for the proect Selected here *******/
$db = $client->music ;
/****** Validating Client for connection ******/
if($client == false){
echo "MongoDB Connection Error" ;
}
/***************USE CASE FOR THE FIlE***********/
/********Choose Collection in main file********/
/***********$collection = $db->news ***********/
/********************************************/
?>