来自 Node.js 的用户的 rethinkdb 密码

rethinkdb password for user from Node.js

我在rethinkdb中成功配置了一个用户"bob"使用密码"secret":

r.db('rethinkdb').table('users').insert({id: 'bob', password: 'secret'})

来自 Node.js,我正在尝试使用 npm 的 rethinkdb 模块连接到它。

r.connect({ host: 'backend', port: 28015, db: 'db', user: 'bob', password: 'secret' });

我收到以下有关密码的错误消息:

Unhandled rejection ReqlAuthError: Wrong password

rethinkdb没有密码,连接成功,所以没有连接问题。使用不同的用户名,我得到了预期的 "unknown user" 错误...当我在 rethinkdb 上创建密码时,我会得到密码的哈希值吗?有什么想法吗?

来自 rethinkDB 文档。

password: the password for the user account to connect as (default "", empty).

Important: You can update a password of a user after you connect to the database.

您可以通过代码行删除密码,方法是使用 update 方法并将密码设置为 false 值。

r.db('rethinkdb').table('users').get('bob').update({password: false})

您可以使用insert方法更改用户密码。这是一个例子。

r.db('rethinkdb').table('users').insert({id: 'bob', password: 'secret'})