When projection is present in a query, return the fields in the order of projection

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I'm very well aware that mongo stores documents and the order of the keys doesn't matter; but find() results with fields that jump around are quite jarring:

      db.links.find() output
      { "name" : "ABC", "links" : [     {       "url" : "http://www.abc.com/",      "text" : "Home page" } ] }
      { "name" : "DEF", "links" : [        {       "url" : "http://www.def.com",   "text" : "Home page" } ] }
      { "links" : [   {       "url" : "http://www.ghi.com",     "text" : "Home page" } ], "name" : "GHI" }
      { "links" : [   {       "url" : "http://www.jkl.com/",      "text" : "Home page" } ], "name" : "JKL" }
      { "name" : "MNO", "links" : [         {       "url" : "http://www.mno.com/",     "text" : "Home page" } ] }
      

            Assignee:
            Backlog - Query Team (Inactive)
            Reporter:
            Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: