2

I have my db in following form

{
"_id" : ObjectId("56fc92adcf908c9f296e5885"),
"_class" : "com.abc.ppm.dto.AccessAttemptDTO",
"url" : "/myProject/edit",
"ipAddress" : "127.0.0.1",
"param" : {
    "iecode" : [ 
        "P1234"
    ],
    "id" : [ 
        "5696578c6d34f835dc632fdd "
    ]
},
"accessTime" : "30-3-2016 10:59:57",
"email" : "[email protected]",
"entity" : "admin",
"entityCode" : ""
},

{
"_id" : ObjectId("56fc92adcf908c9f296e5887"),
"_class" : "com.abc.ppm.dto.AccessAttemptDTO",
"url" : "/myProject/edit",
"ipAddress" : "127.0.0.1",
"param" : {
    "iecode" : [ 
        "P1122"
    ],
    "id" : [ 
        "5696578c6d34f835dc632fdd "
    ]
},
"accessTime" : "30-3-2016 10:59:57",
"email" : "[email protected]",
"entity" : "admin",
"entityCode" : ""

}

Now I want to find all the enries where iecode is 'P1234'. How do I do that? (Note: iecodes value is stored in string array format.)

1 Answer 1

2

You can write query like:

db.collectionName.find({"param.iecode": "P1234"})
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.