-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
679f65e
commit e77304d
Showing
3 changed files
with
379 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const {MongoClient} = require('mongodb'); | ||
const url = 'mongodb://localhost:27017'; | ||
const database = 'e-comm'; | ||
const Client = new MongoClient(url); | ||
|
||
|
||
//connecting to database | ||
async function getData(){ | ||
let result = await Client.connect(); | ||
let db = result.db(database); | ||
let collection = db.collection('products'); | ||
let response = await collection.find({}).toArray(); | ||
|
||
console.log(response); | ||
} | ||
|
||
getData(); |
Oops, something went wrong.