use case 1: Write to DB, Due to network error, system didn’t responded. Data was written to disk
Option 1: Based on case, due to failure, try to write one more time.
Option 2: In sensitive case, read data to make sure that data was written and act acordingly.

——-
Replication

Availability
Fault Tolerance

To select Primary, we need to have odd number of servers.

—————

Types of Replica Set Nodes
1. Regular Node – Primary or Secondary
2. Arbiter Node – Only for voting purposes. No Data on it.
3. Delayed Node – It can’t become primary node. This is one hour late on updates with compare to other nodes.
4. Hidden Node – It can’t become primary node. Used for Analytics
All nodes can participate in election

Like this:

Which of the following aggregation expressions must be used in conjunction with a sort to make any sense?
$first, $last
===================
use agg
db.products.aggregate([
{$group:
{
_id: {
“manufacturer”:”$manufacturer”
},
num_products:{$sum:”$price”}
}
}
])
================