Q9: Explain fundamental comparison operators in MongoDB ($eq, $gt, $in, $nin).
Comparison operators match field values against criteria:
$gt/$gte: Greater than / Greater than or equal to.$lt/$lte: Less than / Less than or equal to.$in: Matches any value specified in an arraystatus: { $in: ['active', 'pending'] }.$nin: Matches values not present in the specified array.
Key Takeaways
$inevaluates array matches in a single query pass.Combine operators for bounded range searches
{ age: { $gte: 18, $lte: 65 } }.
Knowledge Check
Which operator finds documents where a status field equals EITHER 'active' OR 'verified'?