Skip to content

Instantly share code, notes, and snippets.

@parkerfoshay
Created May 18, 2023 15:48
Show Gist options
  • Save parkerfoshay/334ebbea2bf116c2e0f15d8ffd2017ab to your computer and use it in GitHub Desktop.
Save parkerfoshay/334ebbea2bf116c2e0f15d8ffd2017ab to your computer and use it in GitHub Desktop.
node_12_app
{
"name": "node_12",
"version": "1.0.0",
"description": "",
"main": "desk.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"mongodb": "^3.1.13"
}
}
const { MongoClient } = require('mongodb');
const uri = "";
const client = new MongoClient(uri);
client.connect((err) => {
const collection = client.db("sample_supplies").collection("sales");
console.log("err");
collection.findOne({}).then((sale) => {
console.log(sale);
});
client.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment