Mongodb Certified Developer Associate C100dev · Free Practice Question Easy
Question 18
Which of the following MongoDB query operators is used to match a value in an array?
-
A
$ne -
B
$in -
C
$gt -
D
$or
Reveal correct answer
Correct answer: B
A.
The $ne operator is used to match values that are not equal to a specified value. It does not specifically match values in an array.
B.
The $in operator is the correct answer for this question. It is used to match a value against an array of values. It allows you to specify an array of values, and if any of the values in the array match the field value, the document is considered a match.
C.
The $gt operator is used to match values that are greater than a specified value. It does not specifically match values in an array.
D.
The $or operator is used to perform logical OR operations on an array of two or more expressions. It does not specifically match values in an array, but rather provides a way to combine multiple expressions.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
