我的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"
}
]
}
Run Code Online (Sandbox Code Playgroud)
如何在整个列表中查询,例如.如果我想查找包含"忽略"类型的测试用例的所有文档?
我尝试了以下查询
select from testresult where testcases['type'] = 'ignore'
Run Code Online (Sandbox Code Playgroud)
但这导致了NumberFormatException.
select from testresult where testcases[0]['type'] = 'ignore'
Run Code Online (Sandbox Code Playgroud)
工作,但显然只查看每个文档的第一个列表元素.
select from testresult where testcases contains(type = 'ignore')
Run Code Online (Sandbox Code Playgroud)
不提供任何结果,但查询被接受为有效.
更新: 如果测试用例存储为单独的文档而不是嵌入列表,则以下查询按预期工作.
select from testresult where testcases contains (type = 'ignore')
Run Code Online (Sandbox Code Playgroud)
我知道这是一个老问题,但我遇到了同样的问题,只是在这里找到答案:https://www.mail-archive.com/orient-database@googlegroups.com/msg00662.html
以下应该有效.它在我非常类似的用例中.
select from testresult where 'ignore' in testcases.type
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8148 次 |
| 最近记录: |