$eq operator do in MongoDB?The $eq operator checks if a field's value is equal to a specified value. It returns documents where the field matches exactly.
$eq in a MongoDB query to find documents where age is 30?You write: { age: { $eq: 30 } }. This finds documents where the age field equals 30.
{ age: 30 } the same as { age: { $eq: 30 } } in MongoDB queries?Yes, both find documents where age equals 30. The first is shorthand; the second uses $eq explicitly.
$eq be used to compare fields to null in MongoDB?Yes, { field: { $eq: null } } finds documents where field is null or does not exist.
$eq and $ne in MongoDB?$eq checks for equality (equal to), while $ne checks for inequality (not equal to).
{ age: { $eq: 25 } } return in MongoDB?The $eq operator matches documents where the field equals the specified value.
{ name: { $eq: "Alice" } } equivalent to { name: "Alice" }?Both forms find documents where the name field equals "Alice".
$ne means 'not equal', opposite of $eq.
{ score: { $eq: null } }?$eq: null matches fields that are null or do not exist.
status equals "active"?Both forms are valid and find documents where status is "active".
$eq operator works in MongoDB queries.$eq and not using it in a MongoDB query.