[SERVER-5508] in query get mongodb fields in particular order in php (in the order we set in fields of query) Created: 05/Apr/12  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Oleg Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Participants:

 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.



 Comments   
Comment by Tad Marshall [ 05/Apr/12 ]

If by "obliterated" you mean the strikeout (like this ) it is a feature (quirk?) of the Jira software that it interprets some character patterns as formatting commands. If you change the text to add a backslash just before the dash (hyphen) it will leave the dash alone. I'll make this change to your description (dash to backslash-dash) and you should see the change.

Comment by Oleg [ 05/Apr/12 ]

Could you please tell why >find($query) is obliterated?

Generated at Thu Feb 08 03:09:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.