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

XMLWordPrintableJSON

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

      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.

            Assignee:
            [DO NOT USE] Backlog - Query Execution
            Reporter:
            Oleg
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: