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

$in count query with null array does not yield error on empty collection

    XMLWordPrintable

    Details

    • Operating System:
      ALL

      Description

      A count on a collection that exists yields an error on an invalid query. All is good.

      > db.foos.insert(

      { bars: [ 1, 2 ]}

      )
      > db.foos.find({ bars : { $in : [ 1 ]}}).count()
      1
      > db.foos.find({ bars : { $in : null }}).count()
      Mon Feb 11 16:45:53 uncaught exception: count failed:

      { "errmsg" : "exception: invalid query", "code" : 12580, "ok" : 0 }

      A count on a collection that doesn't exist yields 0, which is, IMHO, incorrect.

      > db.invalid.find({ bars : { $in : null }}).count()
      0

      This is an odd optimization, I would expect them to fail the same way.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              dblock Daniel Doubrovkine
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: