Suppose we have a collection named users that contains documents with an array field emails that lists the emails of each user.
Write the query that would return all the users who have exactly 3 emails
{
"_id": 1,
"name": "John Doe",
"emails": ["[email protected]", "[email protected]", "[email protected]"]
},
{
"_id": 2,
"name": "Jane Smith",
"emails": ["[email protected]", "[email protected]", "[email protected]", "[email protected]"]
},
{
"_id": 3,
"name": "Bob Johnson",
"emails": ["[email protected]", "[email protected]", "[email protected]"]
}