$project expressions not working for documents inside arrays

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • None
    • ALL
    • Hide
      1. Restore the attached value.json in any database
      2. Execute the below query, output is correct, review at "output query 1.png"
      
      db.salary.aggregate([{"$match":{"salary.amount":{$gte:5200}}}, {"$project":{"_id":0,"ID":1}} ]).toArray();
      
      3. Execute the below query, output is wrong, review at "output query 2.png"
      
      db.CaseDetail.aggregate([
      {"$match":{"caseAssignedTo":"153"}},
      {"$project":{"_id":0,"agreementNo":1,MI: {"$gte": ["$insuranceDetail.insuredAmount", 6000]}}} 
      ]).toArray();
      
      Show
      1. Restore the attached value.json in any database 2. Execute the below query, output is correct, review at "output query 1.png" db.salary.aggregate([{"$match":{"salary.amount":{$gte:5200}}}, {"$project":{"_id":0,"ID":1}} ]).toArray(); 3. Execute the below query, output is wrong, review at "output query 2.png" db.CaseDetail.aggregate([ {"$match":{"caseAssignedTo":"153"}}, {"$project":{"_id":0,"agreementNo":1,MI: {"$gte": ["$insuranceDetail.insuredAmount", 6000]}}} ]).toArray();
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Match condition is not working inside projection for Embedded dcouments

        1. value.json
          0.6 kB
        2. output query 2.png
          output query 2.png
          6 kB
        3. output query 1.png
          output query 1.png
          5 kB

            Assignee:
            Unassigned
            Reporter:
            guru rajan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: