Skip to main content

What does $gt do?

$gt (greater than) is an operator that selects documents where a field's value is strictly greater than the given one.

Example:

js
db.users.find({ age: { $gt: 18 } })

This query returns every document where age is greater than 18.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.