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

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

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

      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-server-query Backlog - Query Team (Inactive)
            Reporter:
            dandv Dan Dascalescu
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: