How to query and return only the element with the key value in mongodb?
db.test.find({'componentStubs': { $all:[ {$elemMatch: {"id":6484} }] } })
successfully queries, but returns the entire array. How do I return a single field
[
  {
    "_id": ObjectId("5d1b8e0411919967a193d6c5"),
    "componentStubs": [
      {
        "id": 6458,
        "name": "DTCP-DDNBEED01A",
        "modelId": 282,
        "modelName": "Elektron EDGE",
        "modelVersion": 18,
        "lastUpdated": 1562029651988
      },
      {
        "id": 6459,
        "name": "DTCP-DDNBEED01B",
        "modelId": 282,
        "modelName": "Elektron EDGE",
        "modelVersion": 18,
        "lastUpdated": 1562029651808
      },
      {
        "id": 6460,
        "name": "DTCP-DDNBEED02A",
        "modelId": 282,
        "modelName": "Elektron EDGE",
        "modelVersion": 18,
        "lastUpdated": 1562029655639
      },
      {
        "id": 6461,
        "name": "DTCP-DDNBEED02B",
        "modelId": 282,
        "modelName": "Elektron EDGE",
        "modelVersion": 18,
        "lastUpdated": 1562029647511
      }          
    ]
  }
]
 
    