1. Range bounds
$gte and $lt on one field combine to express a half-open range: 18 <= age < 65.
{ $gte: 18, $lt: 65 }Typorithm · easy
Step 1 of 8 · intro card
Query Operators
Comparison operators filter by value: $gt/$gte/$lt/$lte bound ranges, $in/$nin match against a set, and $ne excludes a single value.
Range queries combine $gte (>=) and $lt (<) on the same field to express bounds like 18 <= age < 65.
$in matches a field against any value in an array, while $nin excludes documents whose field is in the array.
$ne keeps every document except those equal to the value — handy for filtering out a single status.
$gt/$gte/$lt/$lte bound numeric and date ranges.
$in matches any value in a set; $nin excludes them.
$ne keeps everything except one exact value.
db.users.find({ age: { $gte: 18, $lt: 65 } })
db.users.find({ role: { $in: ["admin", "editor"] } })
db.users.find({ status: { $ne: "banned" } })
db.users.find({ plan: { $nin: ["free", "trial"] } })Connect each part of the code to the concept before you type.
$gte and $lt on one field combine to express a half-open range: 18 <= age < 65.
{ $gte: 18, $lt: 65 }$in matches when the field equals any value in the array — a set membership test.
{ $in: ["admin", "editor"] }$ne matches documents whose field is anything other than the given value.
{ $ne: "banned" }$nin is the inverse of $in: it excludes documents whose field is in the array.
{ $nin: ["free", "trial"] }Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.