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

Matching results with empty path component don't make sense

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Query Language
    • None
    • Query Optimization
    • ALL

      > db.foo.find({'x.': 1})
      { "_id" : ObjectId("6061e7ac7cc9a947848c1015"), "x" : [ 1 ], "y" : [ { "" : 1 } ] }
      { "_id" : ObjectId("6061e7f27cc9a947848c1016"), "x" : { "" : [ 1 ] }, "y" : [ { "" : 1 } ] }
      > db.foo.find({'y.': 1})
      >
      

      If we aren't going to error when there is an empty path component, the results should at least make sense. I can't think of any reason (modulo bugs of course) why the first document would match {'x.': 1}. And the second document should either match both or neither of {'x.': 1} and {'y.': 1}. The current behavior where it matches one but not the other is odd.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: