How to design the schema for mongoDB

In Node.js + Mongoose, I want to find some user's comment in collection articles.

design 1:

articles:
{
    ...
    users: ["a@a.com","b@b.com","c@c.com"]
    comments: [
        {email:"a@a.com", comment:"..."},
        {email:"b@b.com", comment:"..."},
        {email:"c@c.com", comment:"..."},
        ...
    ]
}

design 2:

articles:
{
    ...
    comments: [
        {email:"a@a.com", comment:"..."},
        {email:"b@b.com", comment:"..."},
        {email:"c@c.com", comment:"..."},
        ...
    ]
}

I am using design 1, first find {users:req.query.user} , then retrieve the user's comments from the result. But I feel it's not smart. Is there some way like solution 2, I don't know how to write the database query.

Your query for the second structure would actually be just as simple. On the mongo shell it would be:

db.collection_name.find({'comments.email': 'a@a.com'})

The query engine is smart enough to introspect into that array and return the documents that honor the requirement.

From that point on you would just need to iterate through the comments in your application code and extract the ones with the matching email. There's no need to do this limiting at query time if this is the way you are structuring your data. Loop through all the comments as needed.

If its important to limit the result set to only comments for a specific user, you may way to rethink the way you are structuring your objects into something more relational (maybe a document for each comment that relates back to an article collection?) Try to consider your schema in terms of what are significant values in terms of lookup potential, and index them where able.