dgraph - 如何让 Dgraph uid_in 使用变量输入
问题描述
我试图将我的数据库引擎更改为 DGraph。我真的需要更改我的应用程序以使用 uid 而不是使用我当前的 ID。我需要使用多个 uid_in 用法进行过滤,目前我的应用程序通过 ID 属性执行此操作。但看起来我不能使用我需要使用 uid 的 ID 属性。但是看起来当你使用 uid_in 函数时你不能使用变量。执行以下操作的最有效方法是什么:
{
SQ (func: eq(id, 10000)) {
dgraph.type
F as uid
}
{
Q2(func: has(id)) @filter(uid_in(edgefield, F)) {
dgraph.type
uid
id
expand(_all_) {
id
uid
dgraph.type
}
}
}
}
解决方案
现在 Dgraph 最新版本 (20.07.X) 支持变量中的 uid 映射。例如:
@filter(uid_in(edgefield, uid(F)))
推荐阅读
- react-native - React Native 需要在圆形按钮上渲染圆形阴影
- python - 为什么在 `super(A, self)` 中,对象会出现在 `self` 之前?
- java - Java SDK Hyperledger Fabric 添加 commitListener
- cisco - FreeRadius,如何从计费数据包中排除某些 url
- scala - spark scala long 在镶木地板数据帧中转换为毫秒的时间戳
- reactjs - 是对的,如何使用 Redux 从 React 应用程序中删除类?
- node.js - s3 文件上传 - 不适用于视频 - React/Meteor - aws-sdk
- c - 为什么我从c中的循环中获得随机输出?
- html - 在jenkins中显示html内容到邮件
- laravel - Laravel 8 (Inertia js) - 获取 Vue 错误'app.js:30559 [Vue 警告]:创建钩子中的错误:“错误:找不到模块...”