diff --git a/Week4/.gitignore b/Week4/.gitignore new file mode 100644 index 000000000..4290ff56a --- /dev/null +++ b/Week4/.gitignore @@ -0,0 +1,2 @@ +.env +node_modules/ \ No newline at end of file diff --git a/Week4/homework/ex1-aggregation/1-Visualize.png b/Week4/homework/ex1-aggregation/1-Visualize.png new file mode 100644 index 000000000..7bacb296c Binary files /dev/null and b/Week4/homework/ex1-aggregation/1-Visualize.png differ diff --git a/Week4/homework/ex1-aggregation/1-importDataPopulation.js b/Week4/homework/ex1-aggregation/1-importDataPopulation.js new file mode 100644 index 000000000..286a16a79 --- /dev/null +++ b/Week4/homework/ex1-aggregation/1-importDataPopulation.js @@ -0,0 +1,41 @@ +import fs from "fs"; +import csv from "csv-parser"; +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + +async function run() { +try { +await client.connect(); +console.log("Connected to MongoDB"); + +const db = client.db("databaseWeek4"); +const collection = db.collection("population"); + +const results = []; + +fs.createReadStream("./homework/ex1-aggregation/population_pyramid_1950-2022.csv") + .pipe(csv()) + .on("data", (row) => { + results.push({ + country: row.Country, + year: Number(row.Year), + age: row.Age, + male: Number(row.M), + female: Number(row.F), + }); + }) + .on("end", async () => { + const inserted = await collection.insertMany(results); + console.log("Inserted:", inserted.insertedCount, "documents"); + await client.close(); + }); + +} catch (err) { +console.error(err); +} +} + +run(); diff --git a/Week4/homework/ex1-aggregation/2-Nederlands.png b/Week4/homework/ex1-aggregation/2-Nederlands.png new file mode 100644 index 000000000..51a71cc79 Binary files /dev/null and b/Week4/homework/ex1-aggregation/2-Nederlands.png differ diff --git a/Week4/homework/ex1-aggregation/2-TotalPopulation.js b/Week4/homework/ex1-aggregation/2-TotalPopulation.js new file mode 100644 index 000000000..5ecffeaa0 --- /dev/null +++ b/Week4/homework/ex1-aggregation/2-TotalPopulation.js @@ -0,0 +1,34 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + +async function getPopulationByCountry(countryName) { +try { +await client.connect(); +const db = client.db("databaseWeek4"); +const collection = db.collection("population"); + +const result = await collection.aggregate([ + { $match: { Country: countryName } }, + { + $group: { + _id: "$Year", + countPopulation: { $sum: { $add: ["$M", "$F"] } } + } + }, + { $sort: { _id: 1 } } +]).toArray(); + +return result; + +} catch (err) { +console.error(err); +} finally { +await client.close(); +} +} + +// Example usage: +getPopulationByCountry("Netherlands").then(res => console.log(res)); diff --git a/Week4/homework/ex1-aggregation/3-AllTheINfo.png b/Week4/homework/ex1-aggregation/3-AllTheINfo.png new file mode 100644 index 000000000..5ec0b90b6 Binary files /dev/null and b/Week4/homework/ex1-aggregation/3-AllTheINfo.png differ diff --git a/Week4/homework/ex1-aggregation/3-AllTheInformation.js b/Week4/homework/ex1-aggregation/3-AllTheInformation.js new file mode 100644 index 000000000..4480c75eb --- /dev/null +++ b/Week4/homework/ex1-aggregation/3-AllTheInformation.js @@ -0,0 +1,30 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + + +async function getContinentPopulationByYearAndAge(year, age) { +try { +await client.connect(); +const db = client.db("databaseWeek4"); +const collection = db.collection("population"); + +const result = await collection.aggregate([ + { $match: { Year: year, Age: age } }, + { $addFields: { TotalPopulation: { $add: ["$M", "$F"] } } }, + { $sort: { Country: 1 } } +]).toArray(); + +return result; + +} catch (err) { +console.error("Error:", err); +} finally { +await client.close(); +} +} + +// Example usage: +getContinentPopulationByYearAndAge(2020, "100+").then(res => console.log(res)); diff --git a/Week4/homework/ex2-transaction/Transfer.png b/Week4/homework/ex2-transaction/Transfer.png new file mode 100644 index 000000000..357cc1bf2 Binary files /dev/null and b/Week4/homework/ex2-transaction/Transfer.png differ diff --git a/Week4/homework/ex2-transaction/index.js b/Week4/homework/ex2-transaction/index.js new file mode 100644 index 000000000..59de06785 --- /dev/null +++ b/Week4/homework/ex2-transaction/index.js @@ -0,0 +1,9 @@ +import { setup } from "./setup.js"; +import { transferAmount } from "./transfer.js"; + +async function main() { +await setup(); +await transferAmount(101, 102, 1000); +} + +main(); diff --git a/Week4/homework/ex2-transaction/package-lock.json b/Week4/homework/ex2-transaction/package-lock.json new file mode 100644 index 000000000..7e83954fb --- /dev/null +++ b/Week4/homework/ex2-transaction/package-lock.json @@ -0,0 +1,179 @@ +{ + "name": "ex2-transaction", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ex2-transaction", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "dotenv": "^17.2.3", + "mongodb": "^7.0.0" + } + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.4.0.tgz", + "integrity": "sha512-ZHzx7Z3rdlWL1mECydvpryWN/ETXJiCxdgQKTAH+djzIPe77HdnSizKBDi1TVDXZjXyOj2IqEG/vPw71ULF06w==", + "license": "MIT", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", + "license": "MIT" + }, + "node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/bson": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.0.0.tgz", + "integrity": "sha512-Kwc6Wh4lQ5OmkqqKhYGKIuELXl+EPYSCObVE6bWsp1T/cGkOCBN0I8wF/T44BiuhHyNi1mmKVPXk60d41xZ7kw==", + "license": "Apache-2.0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "license": "MIT" + }, + "node_modules/mongodb": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^7.0.0", + "mongodb-connection-string-url": "^7.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.806.0", + "@mongodb-js/zstd": "^7.0.0", + "gcp-metadata": "^7.0.1", + "kerberos": "^7.0.0", + "mongodb-client-encryption": ">=7.0.0 <7.1.0", + "snappy": "^7.3.2", + "socks": "^2.8.6" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "license": "MIT", + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/Week4/homework/ex2-transaction/package.json b/Week4/homework/ex2-transaction/package.json new file mode 100644 index 000000000..0dce03f68 --- /dev/null +++ b/Week4/homework/ex2-transaction/package.json @@ -0,0 +1,17 @@ +{ + "name": "ex2-transaction", + "version": "1.0.0", + "description": "", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "dotenv": "^17.2.3", + "mongodb": "^7.0.0" + } +} diff --git a/Week4/homework/ex2-transaction/setup.js b/Week4/homework/ex2-transaction/setup.js new file mode 100644 index 000000000..eb3e2ed42 --- /dev/null +++ b/Week4/homework/ex2-transaction/setup.js @@ -0,0 +1,32 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + +export async function setup() { +try { +await client.connect(); +const db = client.db("databaseWeek4"); +const accounts = db.collection("accounts"); +const accountChanges = db.collection("account_changes"); + +// Clear previous data +await accounts.deleteMany({}); + +await accountChanges.deleteMany({}); + +// Insert sample accounts +await accounts.insertMany([ + { account_number: 101, balance: 5000, account_changes: [] }, + { account_number: 102, balance: 3000, account_changes: [] } +]); + +console.log("Setup done: accounts created with account_changes array."); +} catch (err) { +console.error(err); +} finally { +await client.close(); +} +} + diff --git a/Week4/homework/ex2-transaction/transfer.js b/Week4/homework/ex2-transaction/transfer.js new file mode 100644 index 000000000..c1438ae50 --- /dev/null +++ b/Week4/homework/ex2-transaction/transfer.js @@ -0,0 +1,82 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + +export async function transferAmount(fromAcc, toAcc, amount, remark = "") { +await client.connect(); +const session = client.startSession(); + +try { +const db = client.db("databaseWeek4"); +const accounts = db.collection("accounts"); + +await session.withTransaction(async () => { + // Get current accounts + const fromAccount = await accounts.findOne({ account_number: fromAcc }, { session }); + const toAccount = await accounts.findOne({ account_number: toAcc }, { session }); + + // Determine next change_number + const fromChangeNumber = fromAccount.account_changes.length > 0 + ? fromAccount.account_changes[fromAccount.account_changes.length - 1].change_number + : 0; + + const toChangeNumber = toAccount.account_changes.length > 0 + ? toAccount.account_changes[toAccount.account_changes.length - 1].change_number + : 0; + + // Deduct from sender + await accounts.updateOne( + { account_number: fromAcc }, + { $inc: { balance: -amount } }, + { session } + ); + + // Add to receiver + await accounts.updateOne( + { account_number: toAcc }, + { $inc: { balance: amount } }, + { session } + ); + + // Log changes in account_changes array + await accounts.updateOne( + { account_number: fromAcc }, + { + $push: { + account_changes: { + change_number: fromChangeNumber + 1, + amount: -amount, + changed_date: new Date(), + remark: remark || `Transferred ${amount} to account ${toAcc}` + } + } + }, + { session } + ); + + await accounts.updateOne( + { account_number: toAcc }, + { + $push: { + account_changes: { + change_number: toChangeNumber + 1, + amount: amount, + changed_date: new Date(), + remark: remark || `Received ${amount} from account ${fromAcc}` + } + } + }, + { session } + ); +}); + +console.log(`Transaction successful: ${amount} transferred from ${fromAcc} to ${toAcc}`); +} catch (err) { +console.error("Transaction failed:", err); +} finally { +await session.endSession(); +await client.close(); +} +} diff --git a/Week4/index.js b/Week4/index.js new file mode 100644 index 000000000..92d217291 --- /dev/null +++ b/Week4/index.js @@ -0,0 +1,22 @@ +import { MongoClient } from "mongodb"; +import dotenv from "dotenv"; +dotenv.config(); + +const client = new MongoClient(process.env.MONGO_URI); + +async function run() { +try { +await client.connect(); +console.log("Connected to MongoDB!"); + +const db = client.db("databaseWeek4"); +console.log("Using database:", db.databaseName); + +} catch (err) { +console.error(err); +} finally { +await client.close(); +} +} + +run(); diff --git a/Week4/package-lock.json b/Week4/package-lock.json new file mode 100644 index 000000000..50cf56ac2 --- /dev/null +++ b/Week4/package-lock.json @@ -0,0 +1,193 @@ +{ + "name": "week4", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "week4", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "csv-parser": "^3.2.0", + "dotenv": "^17.2.3", + "mongodb": "^7.0.0" + }, + "devDependencies": {} + }, + "node_modules/@mongodb-js/saslprep": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.4.0.tgz", + "integrity": "sha512-ZHzx7Z3rdlWL1mECydvpryWN/ETXJiCxdgQKTAH+djzIPe77HdnSizKBDi1TVDXZjXyOj2IqEG/vPw71ULF06w==", + "license": "MIT", + "dependencies": { + "sparse-bitfield": "^3.0.3" + } + }, + "node_modules/@types/webidl-conversions": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", + "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==", + "license": "MIT" + }, + "node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/bson": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.0.0.tgz", + "integrity": "sha512-Kwc6Wh4lQ5OmkqqKhYGKIuELXl+EPYSCObVE6bWsp1T/cGkOCBN0I8wF/T44BiuhHyNi1mmKVPXk60d41xZ7kw==", + "license": "Apache-2.0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/csv-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.2.0.tgz", + "integrity": "sha512-fgKbp+AJbn1h2dcAHKIdKNSSjfp43BZZykXsCjzALjKy80VXQNHPFJ6T9Afwdzoj24aMkq8GwDS7KGcDPpejrA==", + "license": "MIT", + "bin": { + "csv-parser": "bin/csv-parser" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "license": "MIT" + }, + "node_modules/mongodb": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^7.0.0", + "mongodb-connection-string-url": "^7.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.806.0", + "@mongodb-js/zstd": "^7.0.0", + "gcp-metadata": "^7.0.1", + "kerberos": "^7.0.0", + "mongodb-client-encryption": ">=7.0.0 <7.1.0", + "snappy": "^7.3.2", + "socks": "^2.8.6" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", + "license": "MIT", + "dependencies": { + "memory-pager": "^1.0.2" + } + }, + "node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/Week4/package.json b/Week4/package.json new file mode 100644 index 000000000..a972278c4 --- /dev/null +++ b/Week4/package.json @@ -0,0 +1,19 @@ +{ + "type": "module", + "dependencies": { + "csv-parser": "^3.2.0", + "dotenv": "^17.2.3", + "mongodb": "^7.0.0" + }, + "name": "week4", + "version": "1.0.0", + "description": "These are the topics for week 4, all in MongoDB:", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": {} +}