如果我执行类似select from #12:1
的操作,很明显,它会返回完整的文档:
{
"result": [
{
"@type": "d",
"@rid": "#12:1",
"@version": 1,
"@class": "Package",
"name": "MsPortfolioStack4.Repository-1.0.4549.25474-alpha",
"p_name": "MsPortfolioStack4.Repository",
"p_ver": "1.0.4549.25474-alpha",
"tags": [
"#14:1",
"#14:2"
],
"@fieldTypes": "tags=z"
}
],
"notification": "Query executed in 0.022 sec. Returned 1 record(s)"
}
现在,如果我有一个JS函数来执行此操作:
function return_node(query) {
return query;
}
我执行select return_node((select from #12:1))
,我只获得RID:
{
"result": [
{
"@type": "d",
"@rid": "#-2:1",
"@version": 0,
"return_node": [
"#12:1"
],
"@fieldTypes": "return_node=z"
}
],
"notification": "Query executed in 0.058 sec. Returned 1 record(s)"
}
是否可以返回实际的扩展文档而不仅仅是RID?目前,最快的方式似乎是遍历结果,但这是多余的。
答案 0 :(得分:1)
您可以更改JS功能
var db = orient.getDatabase(); return db.query(query);
并执行 选择展开(return_node("从#12:1"中选择))(选择return_node("选择#12:1"))