Upsert with $all query and $addToSet operation errors

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.3
    • Component/s: Querying
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      With an empty collection, run this:

      db.Food.update(
          { "names" : { "$all" : [ "corn"]}},
          { "$addToSet" : { "names" : "corn"}},
          { upsert: true });
      

      Results in this error:
      Cannot apply $addToSet to a non-array field. Field named 'names' has a non-array type String in the document INVALID-MUTABLE-ELEMENT

      Tested in 2.6.3
      It worked fine in 2.4.10

              Assignee:
              Unassigned
              Reporter:
              Michael Yoffe
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: