$eq (Comparison Query)

APPLIES TO: MongoDB vCore

The $eq operator is used to match documents where the value of a field is equal to a specified value. This operator is particularly useful for filtering documents based on exact matches. It can be used in various query contexts, such as finding documents with specific field values, filtering arrays, and more.

Syntax

The syntax for the $eq operator is as follows:

{ field: { $eq: value } }

Parameters

Description
field The field to be compared.
count The value to compare against.