我定义了以下资源:
item = {
'wrapper': {
'type': 'dict',
'schema': {
'element': {
'type': 'objectid',
'data_relation': {
'resource': 'code',
'field': '_id',
'embeddable': True,
},
},
},
},
}
当我尝试使用objectid进行查询时,我得到空列表。
http://127.0.0.1:5000/item?where={"wrapper.element":"5834987589b0dc353b72c27d"}
5834987589b0dc353b72c27d是该元素的有效_id。
如果我将数据关系移出嵌入文档,我可以按预期查询
无论如何使用嵌入式数据关系进行此操作?
答案 0 :(得分:1)
我刚刚使用eve==0.7.1
进行了测试,正如您所说,通过使用?where={"wrapper.element" : "<your_objectid>"}
进行过滤,它可以正常工作。
答案 1 :(得分:0)
我遇到一个问题,其中_id
被存储为字符串而不是ObjectId()
,这使查询中断了