0

How to get document by nested value such as "brand" or "storageId" from "trigger.value".

{
    "_id":  "60aee243fff5082ca6fba951",
    "status": "Good",
    "trigger": {
        "value": "{"brand":"A","storageId":"2","emplId":"3"}"
    }
}
2
  • Are you looking to get only selective values returned from the DB? Commented Jun 1, 2021 at 13:34
  • I would like to get elements which have values "brand" = A and "storageId" = 2 Commented Jun 1, 2021 at 13:39

1 Answer 1

3

This should do the trick

db.collection.find({"trigger.value.brand":"A"})

You could add more columns by CSV. This practice is known as dot notations. More on this here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.