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

in query get mongodb fields in particular order in php (in the order we set in fields of query)

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • Querying
    • None
    • Query Execution

    Description

      I get data from mongodb in php and display fields in table. But I get data not in the order I set in fields, for example, in sql database, one gets fields in the same order that are set in the list of fields.

      $cursor = static::getMongoCollection(false)->find($query)->fields($fields);

      For example it displays in the same order now matter if I use:

      $fields = array("field1" => 1, "field2" => 1, "field3" => 1)

      or

      $fields = array("field3" => 1, "field2" => 1, "field1" => 1)

      I need in my application to display fields in different order.

      Attachments

        Activity

          People

            backlog-query-execution Backlog - Query Execution
            oleg_2009 Oleg
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: