我的OrientDB数据库(版本1.0.1)中有一个文档,其结构大致如下:
{
"timestamp": "...",
"duration": 665,
"testcases": [
{
"testName": "test01",
"type": "ignore",
"filename": "tests/test1.js"
},
{
"iterations": 1,
"runningTime": 45,
"testName": "test02",
"type": "pass",
"filename": "tests/test1.js"
},
...
{
"testName": "test05",
"type": "ignore",
"filename": "tests/test1.js"
}
]
}
我如何查询整个列表,例如。是否要查找包含类型为“忽略”的测试用例的所有文档?
我尝试了以下查询
select from testresult where testcases['type'] = 'ignore'
但这导致NumberFormatException
。
select from testresult where testcases[0]['type'] = 'ignore'
可以,但是显然只查看每个文档的第一个列表元素。
select from testresult where testcases contains(type = 'ignore')
不提供任何结果,但该查询被接受为有效。
更新:如果测试用例存储为单独的文档而不是嵌入式列表,则以下查询将按预期工作。
select from testresult where testcases contains (type = 'ignore')
我知道这是一个老问题,但我遇到了同样的问题,只是在这里回答了以下问题:https ://www.mail-archive.com/[email protected]/msg00662.html
以下应该工作。在我的非常相似的用例中确实如此。
select from testresult where 'ignore' in testcases.type
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句