-
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
hhdst
committed
Sep 3, 2024
0 parents
commit 47ae067
Showing
9 changed files
with
108,210 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,38 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
/push.exe |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
{ | ||
"dependencies": { | ||
"@types/figlet": "^1.5.8", | ||
"@types/mongodb": "^4.0.7", | ||
"@types/ws": "^8.5.12", | ||
"dotenv": "^16.4.5", | ||
"figlet": "^1.7.0", | ||
"kleur": "^4.1.5", | ||
"mongodb": "^6.8.0", | ||
"rage-edit": "^1.2.0", | ||
"tslib": "^2.7.0", | ||
"ws": "^8.18.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^22.5.1" | ||
} | ||
} |
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,50 @@ | ||
|
||
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; | ||
import fs from 'fs' | ||
import { MongoClient } from 'mongodb' | ||
import dotenv from 'dotenv' | ||
import path from 'path' | ||
|
||
const envPath = path.resolve(__dirname, '.env.local'); | ||
if (fs.existsSync(envPath)) { | ||
dotenv.config({ path: envPath }); | ||
}; | ||
|
||
(async () => { | ||
|
||
const client = new MongoClient(process.env.MONGOURL); | ||
|
||
try { | ||
await client.connect(); | ||
console.log('Connected to the MongoDB server'); | ||
const db = client.db(process.env.MONGODB_DB); | ||
|
||
let t = await db.collection("test") | ||
let result = await t.insertMany([{ | ||
fname:"ali", | ||
lname:"akbari", | ||
age:22, | ||
blance:1500 | ||
}, | ||
{ | ||
fname:"hasan", | ||
lname:"akbari", | ||
age:22, | ||
blance:1500 | ||
}, | ||
{ | ||
fname:"kamran", | ||
lname:"akbari", | ||
age:22, | ||
blance:1500 | ||
|
||
|
||
}]) | ||
console.log(result) | ||
} catch { | ||
console.log("Failed to connect to Mongo Server.") | ||
} | ||
})() | ||
|
||
|
||
|
Binary file not shown.
Oops, something went wrong.