I'm trying to search an object array for a specific value inside of a query. How would I get the user "taylor" from the following lines of an already made query?
I've tried $elemMatch :{user:"taylor"} but that just returns all accounts following Taylor. I need it to just get the username starman's following of Taylor. Context: I'm making an if statement to search if someone is already following an account so I can res.json a message saying "You already follow them!" to stop duplicate followers.
{
    "success": true,
    "user": {
        "name": "Kyle",
        "username": "starman",
        "bio": "Why yes I am a groupie, how did you know?",
        "avatar": "https://i.imgur.com/YfyWjq4.gif",
        "phone": "6788456456",
        "followers": [],
        "following": [
            {
                "user": "taylor"
            },
            {
                "user": "trevor"
            }
        ]
    }
}
 
     
    