- 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.
- 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
node index_mongo.js
- displays data from MongoDB Atlas collection using Mongo commandsnode index_mongoose.js
- displays data from MongoDB Atlas collection using Mongoose commandsnpm run todos
- a CRUD CLI that lists, adds, deletes and edits todos in a MongoDB Atlas collection
Note that you have to create both a (1) Custom Role and (2) Specific Privileges: