Python 使用eve REST API在GET查询中按值排序dict
我的域配置中有以下架构:Python 使用eve REST API在GET查询中按值排序dict,python,mongodb,rest,eve,Python,Mongodb,Rest,Eve,我的域配置中有以下架构: DOMAIN = { 'adv': { 'schema': { '_id': {'type': 'string'}, 'matchups': { 'type': 'dict', 'schema': { 'name': {'type': 'string'}, 'value': {'type': 'double'} }, }, },
DOMAIN = {
'adv': {
'schema': {
'_id': {'type': 'string'},
'matchups': {
'type': 'dict',
'schema': {
'name': {'type': 'string'},
'value': {'type': 'double'}
},
},
},
},
}
尽管按\u id
排序有效:
http://127.0.0.1:5000/adv/?sort=[("_id",1)]
按dict值或名称排序不起作用:
http://127.0.0.1:5000/adv/?sort=[("matchups.value",1)]
常规终结点不支持按子文档字段排序。然而,您可以使用一个类似的方法来实现类似的结果