users with documents containing an age field, which query returns all users older than 30?db.users.find({ age: { $gt: 30 } })The $gt operator selects documents where the value of the field is strictly greater than the specified value. So { age: { $gt: 30 } } returns users older than 30, not including 30.
db.users.find({ age: { $gte: 30 } })The $gte operator selects documents where the field value is greater than or equal to the specified value. So { age: { $gte: 30 } } includes users who are exactly 30 years old as well as older.
$gt and $gte in MongoDB queries?$gt means strictly greater than, so it excludes the boundary value. $gte means greater than or equal to, so it includes the boundary value.
score is greater than 50?The correct syntax uses { field: { $operator: value } }. Option C follows this pattern. Options B, C, and D are invalid syntax.
price field. Which query will best use the index to find documents with price greater than or equal to 100?Option B directly queries for price >= 100, which matches the index efficiently. Option B uses $gt 99 which is equivalent but less clear. Option B adds an upper bound which may be useful but is not asked. Option B excludes 100, so it misses some documents.