Which operator is used to find documents with a value less than in MongoDB?

Prepare for the MongoDB Associate Developer Exam with flashcards and practice multiple choice questions. Each question includes hints and explanations to ensure you're ready for test day.

In MongoDB, the operator used to find documents with a value less than a specified value is the less than operator, denoted as $lt. When this operator is utilized in a query, it returns documents where the specified field's value is strictly less than the provided value. This is particularly useful in scenarios where you want to filter datasets based on upper thresholds.

For example, if you have a collection of products and you want to find all products priced under $50, you would use a query with the $lt operator to specify that the field representing price should be less than 50. This operator effectively limits the results to only those that meet this criterion, ensuring that you retrieve relevant information for your needs.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy