redash
redash copied to clipboard
Error in mongodb query
i have redash instance v8 and moving queries to new redash instance v10 my query is
{
"collection": "statistics",
"query": {
"failureCauses": {"$exists": false},
"startingTime": {"$gt" : {"$humanTime": "{{ start }}"}, "$lt" : {"$humanTime": "{{ end }}"}},
"result" : "FAILURE",
"projectName": "{{ project }}"
},
"fields": {
"projectName": 1,
"buildNumber": 2,
"slaveHostName": 3,
"startingTime": 4,
"link": {
"$concat": ["https://jenkins.example.com/job/", "$projectName", "/", {"$toString": "$buildNumber"}]
}
},
"sort": [{
"name": "startingTime",
"direction": -1
}]
}
in redash v8 this query works fine, but in redash v10 i receive error Error running query: '<' not supported between instances of 'dict' and 'int' error in sorting fields. When i remove "link" field - no error, and when i remove all fields besides "link" - again no error
Seeing the same kind of issue, in addition I believe if you remove all the fields but the link field but then duplicate it and call it link2 it also seems to get the same error.
At first I thought it might be mixing calculated fields and non calculated fields but it appears that even if you have two calculated fields it responds with the error Error running query: '<' not supported between instances of 'dict' and 'int'
.
@namepunk @ChrisMagnuson Thanks for your report. Reproduced.
Traceback (most recent call last):
File "/app/redash/tasks/queries/execution.py", line 182, in run
data, error = query_runner.run_query(annotated_query, self.user)
File "/app/redash/query_runner/mongodb.py", line 338, in run_query
for k in sorted(f, key=f.get):
TypeError: '<' not supported between instances of 'dict' and 'int'
If you set a non-numeric to the value of the fields
dict, this error will occur. This seems to be a bug.