MongoDB Operators Quiz (original) (raw)
Which MongoDB operator is used to compare two values and return -1, 0, or 1?
What does the $gte operator do in MongoDB?
- Compares if one value is greater than another
- Checks if a field is greater than or equal to a given value
- Compares if one value is strictly equal to another
- Sorts documents in ascending order
Which logical operator in MongoDB returns true if all conditions are met?
What does the $multiply operator do in MongoDB?
- Finds the product of an array of numbers
- Multiplies a field value by a specified number
- Performs an aggregation on numeric fields
Which MongoDB operator adds elements to an array?
How does the $pop operator work in MongoDB?
- Removes the last element of an array
- Removes the first element of an array
- Removes an element at a specified index
- Can remove the first or last element of an array
What is the function of the $rename operator in MongoDB?
- Renames a field in a document
- Changes the type of a field
- Removes a field from a document
Which array query operator is used to return the length of an array?
What does the $strcasecmp operator do in MongoDB?
- Converts a string to uppercase
- Compares two strings case-insensitively
- Splits a string into an array
How do you find an element at a specific index in a MongoDB array?
There are 10 questions to complete.
Take a part in the ongoing discussion