0

I will to retrieved a data from MongoDb one the file to check is on a array.

I mean I have my collection "colorin" with data as:

{
    "_id" : "411",
    "addinon" : [
        {
            "key" : "0001",
            "name" : "ClaroEsta"
        },{
            "key" : "0002",
            "name" : "ClaroNOEsta"
        },
    ]
}

so I would like to retrieve a colorin that is equial in KEY = "001"

What would be the best approach.

1 Answer 1

2
db.colorin.find({ addinon: { $elemMatch: { key: "001" } } });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.