Skip to content

edwardtanguay/starter-mongo-mongoose-atlas

Repository files navigation

starter-mongo-mongoose-atlas

  • This is a collection of code that connects to a MongoDB Atlas database via Mongo and Mongoose commands.
  • The CRUD CLI uses Mongoose to list, add, delete and edit todos in a database collection at MongoDB Atlas.
  • Below are instructions on how to restrict a MongoDB Atlas user to only be able to read/write to a specific database collection.

democlietodolist

setup

  • clone locally
  • npm i
  • create MongoDB Atlas database e.g. "test001-cli"
  • create a collection in that database called "todos"
  • create an .env file:
MONGO_ATLAS_CLUSTER_URL = cluster0.EXAMPLE.mongodb.net
MONGO_USER = nnn
MONGO_PASSWORD = nnn
MONGO_DATABASE = nnn
MONGO_COLLECTION = nnn

execute

  • node index_mongo.js - displays data from MongoDB Atlas collection using Mongo commands
  • node index_mongoose.js - displays data from MongoDB Atlas collection using Mongoose commands
  • npm run todos - a CRUD CLI that lists, adds, deletes and edits todos in a MongoDB Atlas collection

set up a MongoDB user that only has read/write access to a specific database and collection

Note that you have to create both a (1) Custom Role and (2) Specific Privileges:

grafik

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published