positional $ operator when there are two array path in query

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL
    • Query Optimization 2021-02-22
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      having following document:

      {
        "user": [1],
        "grades": [
          {"grade": 80, "mean": 75, "std": 40},
          {"grade": 85, "mean": 90, "std": 45},
          {"grade": 90, "mean": 85, "std": 50}
        ]
      }
      

       

      this query:

      db.students.updateOne(
        { user: 1, "grades.grade": 85 },
        { $set: { "grades.$.std" : 6 } }
      )
      

       

      update first element in grades instead of second one.

            Assignee:
            Charlie Swanson
            Reporter:
            Ali Rahbari
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: