Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4492

$all/$elemMatch needs to be applied to array error for non-existant field

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.0
    • Affects Version/s: 2.0.1
    • Component/s: Querying
    • None
    • Environment:
      Windows, Unix
    • ALL

      If I execute an $all/$elemMatch on a collection for a field that is missing from a document in the collection, I get a "$all/$elemMatch needs to be applied to array" error. It can be reproduced in it's simplest form with the following:

      > db.example.insert({})
      > db.example.find({foo: { $all: [{ $elemMatch: { baz: 'Test'}}]}})
      error:

      { "$err" : "$all/$elemMatch needs to be applied to array", "code" : 13021 }

      >

      The expectation is that no error is thrown and the lack of the field is simply ignored.

            Assignee:
            aaron Aaron Staple
            Reporter:
            davidmohara David O'Hara
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: