$all with single element matches scalar

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The documentation for $all says:

      The $all operator selects the documents where the value of a field is an array that contains all the specified elements. 

      However this does not match the following behavior on master:

      > coll.drop()
      > coll.insert({_id: 1, a: 1})
      > coll.find({a: {$all: [1]}})
      {_id: 1, a: 1 }

      If these are the intended semantics, we should update this ticket to request a docs update. If however, these semantics are unintentional, and $all should only match arrays (similar to $elemMatch), this ticket should fix the behavior.

              Assignee:
              Katya Kamenieva
              Reporter:
              Ben Shteinfeld
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: