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

Query projection behavior shouldn't depend on order of fields

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query
    • ALL

      I don't know which is correct, but they should do the same thing (possibly both erroring out).

      > db.foo.find()
      { "_id" : ObjectId("4fff661614a4344a2507267c"), "a" : { "b" : { "c" : 1 } } }
      { "_id" : ObjectId("4fff73ad14a4344a2507267d"), "a" : [ { "b" : [ { "c" : 1 } ] } ] }
      > db.foo.find({}, {'a':1, 'a.c':1})
      { "_id" : ObjectId("4fff661614a4344a2507267c"), "a" : { } }
      { "_id" : ObjectId("4fff73ad14a4344a2507267d"), "a" : [ { } ] }
      > db.foo.find({}, {'a.c':1, a:1})
      { "_id" : ObjectId("4fff661614a4344a2507267c"), "a" : { "b" : { "c" : 1 } } }
      { "_id" : ObjectId("4fff73ad14a4344a2507267d"), "a" : [ { "b" : [ { "c" : 1 } ] } ] }
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: