Loading

Quipoin Menu

Learn • Practice • Grow

mongodb / Query Operators
mcq
Direction: Choose the correct option

Q1.

Which operator is used for equality comparison in MongoDB queries?
A. $gt
B. $in
C. $lt
D. $eq
Direction: Choose the correct option

Q2.

How would you find documents where the 'age' field is greater than 18?
A. {age: 18}
B. {age: {$gte: 18}}
C. {age: {$gt: 18}}
D. {age: {$lt: 18}}
Direction: Choose the correct option

Q3.

Which operator is used to match documents where a field value is in a specified array?
A. $elemMatch
B. $in
C. $nin
D. $all
Direction: Choose the correct option

Q4.

What does the `$regex` operator allow you to do?
A. Validate email format
B. Perform pattern matching using regular expressions
C. Extract substrings
D. Replace text
Direction: Choose the correct option

Q5.

How do you find documents where the 'tags' array contains both 'red' and 'blue'?
A. {tags: {$in: ['red', 'blue']}}
B. {tags: {$elemMatch: {$eq: 'red', $eq: 'blue'}}}
C. {tags: ['red', 'blue']}
D. {tags: {$all: ['red', 'blue']}}