click below
click below
Normal Size Small Size show me how
INTPROG - L8
Introduction to MongoDB
| Question | Answer |
|---|---|
| is a document-oriented database that falls under the NoSQL category | MongoDB |
| Used to start the MongoDB Shell, which allows you to interact with your MongoDB databases from the command line | mongosh |
| How NoSQL works? | Documents are like rows but without schema |
| Code format for MongoDb Data | { "name": "Jianna Shae", "age": 28, "email": "Jiannashae@gmail.com" }, |
| Basic Commands in MongoDB Shell | Basic Commands in MongoDB Shell |
| Lists all databases on the server | show databases |
| Lists all collections in the current database | show collections |
| Find records in a collection. | db.<collection name>.find() |
| Inserts a single document into a collection. | db.<collection_name>.insertOne({ <document> }) |
| Updates documents in a collection. | db.<collection_name>.updateOne({ <query> }, { $set: { <update_fields> } }) |
| Deletes documents from a collection. | db.<collection_name>.deleteOne({ <query> }) |
| Clear Console | cls |
| Create Collection | db.createCollection(“collection name” |