Query projection behavior shouldn't depend on order of fields

XMLWordPrintableJSON

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

      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 - Query Team (Inactive)
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: