I have an aggregation query and would like to change the order in which the columns are displayed in the dataset table in redash. (For example, I want column “A” to be the leftmost column) Is this currently supported?

I expected to be able to to change the order of the attributes in my last $project statement in the aggregation in order to control the order of the columns (robomongo / robo 3T works this way) but redash seems to maintain its own column order.

Many thanks!

2 Likes

I have this error too. I have a different order in my query and table. In my query it’s: [1 2 3 4 5 6], but In table It: [1 2 6 5 4 3]. And when I change columns headers through $project attributes, columns order change too.

1 Like

I got the same error here.
Plus the column order seems to change when I resave the query.

Anyone ?

Thanks for reading

I reported this as an Issue in github and was offered a functional workaround: specify a fields projection with integers showing the intended order. e.g:

{
	"collection": "my_collection",
	"aggregate": [
        { "$match": { "some_field": "some_value" } }, 
        { "$project": 
            {
	            "first_field": { "$someExpression": "someValue" },
 	            "second_field": true,
	            "third_field": { "$someOtherExpression": [ "$some", "some_value" ] },
	            "_id": false
	        }
	    }
    ],
	"fields": {
	        "first_field": 1,
	        "second_field": 2,
	        "third_field": 3,
	}
}

Notice that it’s the sorting order of the values of the fields dictionary that matter, not the order of the keys themselves, so if you change "second_field" from 2 to to 4 it will show last, whereas if you just rearrange the "key": value lines inside `fields’ itself, nothing will change.