Key Takeaways About $eq Operator
- The $eq Operator is one of the comparison operator in MongoDB.
- It is used to match values exactly in MongoDB.
- It is used to filter data based on exact match.
- If the specified
<value>
is an array, MongoDB matches documents where the<field>
matches the array exactly or the<field>
contains an element that matches the array exactly.
MongoDB – $eq Operator
MongoDB $eq operator or equality operator is a comparison operator. The $eq operator matches documents where the value of the field is equal to the specified value.
Important Points:
- If the given value is a document, then the order of the fields in the document is important.
- If the given value is an array, then MongoDB matches the documents where the field contains an element that exactly matches the specified array.