This file contains 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 characters
Terminology | |
Database A container for collections. This is the same as a database in SQL and | |
usually each project will have its own database full of different collections. | |
Collection | |
A grouping of documents inside of a database. This is the same as a table in | |
SQL and usually each type of data (users, posts, products) will have its own | |
collection. | |
Document | |
A record inside of a collection. This is the same as a row in SQL and usually |
This file contains 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 characters
Assignment 2 | |
1.db.assign1.find({"age": { $in: [40]}}).pretty() | |
2. db.assign1.find({ $all: [{"gender": "Female"}, {"age": {$gte: 20, $lte: 30}}]}).pretty() | |
3. db.assign1.find({ $and: [{"gender": "Female"}, {"age": {$gte: 20, $lte: 30}}]}).pretty() |
This file contains 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 characters
1. Database Commands | |
a.View all databases | |
show dbs | |
b.Create a new or switch databases | |
use dbName | |
c.View current Database | |
db |