Rethinkdb getField()给出错误

时间:2017-06-07 23:52:32

标签: rethinkdb feathersjs reql

这是错误:

toJSON`取0参数,1后提供:\ nr.table(\" users \")。get(\" c62b27da-c0c2-4bfd-bd77-aaa95f215ec5 \&# 34)(\"帐户\")"

这是我的代码:

`const userId = hook.params.user.id;
          const r = this.options.r;
          const accountId = r.table('users').get(userId).getField('account');
          if(accountId != null) {
            hook.data = Object.assign({}, hook.data, {
              createdBy: userId,
              account: accountId
            });
          }`

这是代码的一部分,但我认为它显示了代码的哪一部分给了我错误!

请帮忙!

1 个答案:

答案 0 :(得分:1)

您错过了对.run(conn)的电话。

在您的代码中,constId常量不包含id,它包含未评估的ReQL查询。

请参阅https://rethinkdb.com/docs/introduction-to-reql/