【问题标题】:How to get Dgraph uid_in to use variable inputs如何让 Dgraph uid_in 使用变量输入
【发布时间】:2020-08-19 12:23:20
【问题描述】:

我正在尝试将我的数据库引擎更改为 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


    【解决方案1】:

    现在 Dgraph 最新版本 (20.07.X) 支持变量中的 uid 映射。例如:

    @filter(uid_in(edgefield, uid(F)))
    

    https://github.com/dgraph-io/dgraph/pull/5320

    【讨论】:

      猜你喜欢
      • 2019-12-02
      • 2020-02-29
      • 1970-01-01
      • 2017-03-03
      • 1970-01-01
      • 2014-05-19
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多