Skip to content

Commit

Permalink
hello_world task: done
Browse files Browse the repository at this point in the history
  • Loading branch information
10023r committed Sep 26, 2023
1 parent ab5d38f commit cba4757
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hello_world/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const {MongoClient} = require('mongodb')

const client = new MongoClient("mongodb://127.0.0.1:27017/")

const start = async () => {
try {
await client.connect()
console.log("Connected to mongo")
await client.db().createCollection("Tmp")
const users = client.db().collection("Tmp")
await users.insertOne({text: "Hello world!"})
const user =await users.findOne({text: "Hello world!"})
console.log(user)
client.close()
} catch (e) {
console.log(e)
}
}

start()
14 changes: 14 additions & 0 deletions hello_world/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "dentist_project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"mongodb": "^6.1.0"
}
}

0 comments on commit cba4757

Please sign in to comment.