Please enable JavaScript.
Coggle requires JavaScript to display documents.
DATA BASE - Coggle Diagram
DATA BASE
NOSQL
MONGODB
-
Installation
Tools
Mongo Shell
mongosh (start)
-
-
-
-
-
-
-
CRUD
Create
-
db.{collection}.insertMany([{json}, {json}, ...])
Read
-
db.{collection}.find({filter}) --> filter = {{prop}:{val}, {prop}:{val}, ...}
db.{collection}.find({filter}, {prop}) --> prop = {{prop}: 1 | 0, {prop}: 1 | 0, ...}
-
-
-
db.{collection}.sort({property}) --> property = {{property}: 1 | -1, {property}: 1 | -1, ...}
Operators ($name)
- 8 more items...
-
Update
db.{collection}.updateOne({filter}, {$set: {prop1: val1, prop2: val2, ...})
db.{collection}.updateMany({filter}, {$set: {prop1: val1, prop2: val2, ...})
db.{collection}.updateOne({filter}, {$inc: {prop1: incremental, prop2: -decremental, ...})
db.{collection}.updateOne({filter}, {$pull/$push: {prop1: val, prop2: val, ...}) --> remove/Insert value to an array
db.{collection}.updateOne({filter}, {$push: {prop1:{$each: [val1, val2, ...]}}}) --> add or remove many values from an array
-
-
-
Integration
All the find queries return a cursor, so we need to iterate on it to get each vale
To make a query by using mongoI id, you have to use ObjectId methid
-
-
-