Last active
July 14, 2021 21:16
-
-
Save danny-andrews/3689df8abb5dbee9627ab08d89f7687c to your computer and use it in GitHub Desktop.
Revisions
-
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ ## Installation 1. `$ brew tap mongodb/brew` 1. `$ brew install mongodb-community` - Installs mongodb server on your machine.<sup id="1">[1](#f1)</sup> 2. `$ brew services start mongodb-community` - Starts mongodb server locally.<sup id="2">[2](#f2)</sup> 3. `$ npm install mongodb` - Installs mongodb node package. -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ db/mongo-config.js: ```js const { MongoClient } = require("mongodb"); const URI = "mongodb://localhost:27017/"; @@ -32,7 +32,7 @@ const insertStuff = async () => { await client.close(); }; insertStuff(); ``` -
danny-andrews revised this gist
Jul 14, 2021 . No changes.There are no files selected for viewing
-
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,6 @@ await insertStuff(); 1. API Docs: https://mongodb.github.io/node-mongodb-native/4.0/ 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect <sup id="f1">[1](#1)</sup>Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). <sup id="f2">[2](#2)</sup>By default, this will run on `localhost:27017`. -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,6 @@ await insertStuff(); 1. API Docs: https://mongodb.github.io/node-mongodb-native/4.0/ 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect <sup id="f1">[1](#1)</sup>Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). [↩](#1) <sup id="f2">2</sup>By default, this will run on `localhost:27017`. [↩](#2) -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,6 @@ await insertStuff(); 1. API Docs: https://mongodb.github.io/node-mongodb-native/4.0/ 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect <sup id="f1">[↩](#1)</sup>Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). [↩](#1) <sup id="f2">2</sup>By default, this will run on `localhost:27017`. [↩](#2) -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,9 @@ const insertStuff = async () => { const db = client.db("fec"); const collection = db.collection("items"); await collection.insertOne({ name: "stuff" }); // You have to close the connection, or the app will hang. // You'll probably want to do this in an afterAll hook in your tests. await client.close(); }; -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -40,4 +40,5 @@ await insertStuff(); 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect <sup id="f1">1</sup>Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). [↩](#1) <sup id="f2">2</sup>By default, this will run on `localhost:27017`. [↩](#2) -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,10 @@ ## Introduction 1. Read: https://docs.mongodb.com/manual/introduction/ 2. Read: https://docs.mongodb.com/manual/crud/  ## Installation @@ -33,8 +36,6 @@ await insertStuff(); ## References 1. Bulk writes: https://docs.mongodb.com/manual/core/bulk-write-operations/ 1. API Docs: https://mongodb.github.io/node-mongodb-native/4.0/ 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,9 @@ # MongoDB Quickstart ## Introduction  ## Installation 1. `$ brew install mongodb-community` - Installs mongodb server on your machine.<sup id="1">[1](#f1)</sup> -
danny-andrews revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,11 @@ # MongoDB Quickstart  ## Installation 1. `$ brew install mongodb-community` - Installs mongodb server on your machine.<sup id="1">[1](#f1)</sup> 2. `$ brew services start mongodb-community` - Starts mongodb server locally.<sup id="2">[2](#f2)</sup> 3. `$ npm install mongodb` - Installs mongodb node package. ## Usage db/mongo-config.js: -
danny-andrews created this gist
Jul 14, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ # MongoDB Quickstart ## Installation 1. `$ brew install mongodb-community` - Installs mongodb server on your machine.<sup id="1">[1](#f1)</sup> 2. `$ brew services start mongodb-community` - Starts mongodb server locally.<sup id="2">[2](#f2)</sup> 3. `$ npm install mongodb` - Installs mongodb node package. ## Introduction Introduction to MongoDB: https://docs.mongodb.com/manual/introduction/ Intro to CRUD operations: https://docs.mongodb.com/manual/crud/ [](https://beginnersbook.com/wp-content/uploads/2017/09/RDBMS_MongoDB_Mapping.jpg) ## Usage db/mongo-config.js: ```js import { MongoClient } from "mongodb"; const URI = "mongodb://localhost:27017/"; const insertStuff = async () => { const client = await new MongoClient(URI).connect(); const db = client.db("fec"); const collection = db.collection("items"); await collection.insertOne({ name: "stuff" }); await client.close(); }; await insertStuff(); ``` ## References 1. Bulk writes: https://docs.mongodb.com/manual/core/bulk-write-operations/ 1. Intro to CRUD operations: https://docs.mongodb.com/manual/crud/ 1. Introduction to MongoDB: https://docs.mongodb.com/manual/introduction/ 1. API Docs: https://mongodb.github.io/node-mongodb-native/4.0/ 1. Shell Docs: https://docs.mongodb.com/mongodb-shell/connect/#std-label-mdb-shell-connect <sup id="f1">1</sup>Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). [↩](#1) <sup id="f2">2</sup>By default, this will run on `localhost:27017`. [↩](#2)