Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akunna1/using-mongodb-compass-and-atlas
Setting up MongoDB for projects
https://github.com/akunna1/using-mongodb-compass-and-atlas
database mongodb-atlas mongodb-compass nosql
Last synced: 24 days ago
JSON representation
Setting up MongoDB for projects
- Host: GitHub
- URL: https://github.com/akunna1/using-mongodb-compass-and-atlas
- Owner: akunna1
- Created: 2024-08-19T16:07:17.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T17:33:00.000Z (4 months ago)
- Last Synced: 2024-08-20T19:45:07.504Z (4 months ago)
- Topics: database, mongodb-atlas, mongodb-compass, nosql
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Basics about MongoDB
- NoSQL database (i.e not relational, not made out of rows and columns)
- MongoDB uses collections and documents
- Collecions store a specific type of data record e.g users, authors, books
- In a collection are documents
- documents have JSON format, but actually they are stored as bison
- It can be used to store nested documents#### MongoDB-Compass Vs. MongoDB Atlas
- MongoDB-Compass: the local version
- MongoDB-Atlas: the online version. Use to make and host a cluster online. It an be connected to MongoDB Compass through a connection string.#### Installing MongoDB Compass
- https://www.mongodb.com/try/download/community
- Make sure install mongoDB as a service is checked
- install mongoDB shell from https://www.mongodb.com/try/download/shell
- open terminal and type mongosh
- show dbs
- use database_name
- inserting data from shell to mongodb:
- - db database_name.collection_name e.g database_name is bookstore, collection_name is books
- db.books.insertOne({title: "The Color of the Wind", author"Terry Henry", pages: 450, rating: 7, genres: ["fantasy", "magic"]}) --> inserting one document
- db.books.inserMany({title: "The Color of the Wind", author"Terry Henry", pages: 450, rating: 7, genres: ["fantasy", "magic"]}, {title: "Va Va Voom", author"Mickey Mouse", pages: 234, rating: 9, genres: ["children", "magic"]}) ---> inserting many
- db.books.find()
- db.books.find({author: "Mickey Mouse"}) --> to filter
- db.books.find({author: "Mickey Mouse", rating: 7}) --> 2 filters#### MongoDB Compass Drivers e.g Node.js