[SERVER-7625] Support $elemMatch projection on nested documents Created: 12/Nov/12  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: 2.2.1, 2.5.3
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Patryk Wasik Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 1
Labels: query_triage
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File server7625.js    
Issue Links:
Depends
Assigned Teams:
Query Execution
Participants:

 Description   

It will be nice to have support $elemMatch projection on nested documents.
For example when schama look like this to support multilingual:

{
  "name": [
    {
      "locale": "en",
      "value": "milk"
    },
    {
      "locale": "de",
      "value": "milch"
    }
  ],
  "brand": {
    "attribute": "value1",
    "name": [
      {
        "locale": "en",
        "value": "MilkBrand"
      },
      {
        "locale": "de",
        "value": "MilchMarke"
      }
    ]
  }
}
 

this query is unsupported

db.test.find({},{name:{$elemMatch:{locale:"en"}},"brand.name":{$elemMatch:{locale:"en"}}})


Generated at Thu Feb 08 03:15:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.