# MongoDB Quickstart ## Introduction 1. Read: https://docs.mongodb.com/manual/introduction/ 2. Read: https://docs.mongodb.com/manual/crud/ ![](https://beginnersbook.com/wp-content/uploads/2017/09/RDBMS_MongoDB_Mapping.jpg) ## Installation 1. `$ brew install mongodb-community` - Installs mongodb server on your machine.[1](#f1) 2. `$ brew services start mongodb-community` - Starts mongodb server locally.[2](#f2) 3. `$ npm install mongodb` - Installs mongodb node package. ## 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. 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 1Linux instructions [here](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/). [↩](#1) 2By default, this will run on `localhost:27017`. [↩](#2)