Fix which prevented MongoDB connections to execute queries due to a faulty json schema configuration.

This commit is contained in:
Eran Sandler 2015-04-22 00:18:28 +03:00
parent 1e3b507b2b
commit 0f0acfdd12

View File

@ -68,8 +68,8 @@ class MongoDB(BaseQueryRunner):
'type': 'string',
'title': 'Replica Set Name'
},
'required': ['connectionString']
}
},
'required': ['connectionString']
}
@classmethod
@ -132,8 +132,8 @@ class MongoDB(BaseQueryRunner):
s = None
if "sort" in query_data and query_data["sort"]:
s = []
for field_name in query_data["sort"]:
s.append((field_name, query_data["sort"][field_name]))
for field_data in query_data["sort"]:
s.append((field_data["name"], field_data["direction"]))
columns = []
rows = []
@ -146,6 +146,9 @@ class MongoDB(BaseQueryRunner):
else:
cursor = db[collection].find(q, f)
if "limit" in query_data and query_data["limit"]:
cursor = cursor.limit(query_data["limit"])
for r in cursor:
for k in r:
if _get_column_by_name(columns, k) is None:
@ -177,4 +180,4 @@ class MongoDB(BaseQueryRunner):
return json_data, error
register(MongoDB)
register(MongoDB)