Please enable JavaScript.
Coggle requires JavaScript to display documents.
MONGO-DB_2 - Coggle Diagram
MONGO-DB_2
FINDING
.find(searchObj)
searchObj
{name: "John", age: 26}
String
Different
From-Integers
One
.findOne(searchObj)
Count
.countDocuments(searchObj)
DELETING
One
.deleteOne(..)
Many
.deleteMany(..)
Arg
searchObj
Returns
{acknowledged:true,
deletedCount: 1 }
GETTING
db.collection
.find()
All
Returns
Array-Of
{_id: ObjectId(), name:..}
SORT
db.collection
.find()
.sort(sortObj)
sortObj
k-v-pairs
Key
fieldName
Value
1-asc
-1-desc
Multifield
{age: -1, name: 1}
First-Age
Then
Having
Same-age
Names
REPLACING
.replaceOne(..)
searchObj
replaceWithObj
Whole
Object
Is-Removed
And-Replaced
Returns
Similar
To-Update
LIMITING
db.collection
.find().limit(2)
SKIPPING
db.collection
.find().skip(2)
SELECTING
db.collection
.find(..)
Args
selectObj
searchObj
Selectors
{age: 1, id: 0}
Including
1
Excluding
0