MongoDB 凭证(MongoDB credentials)#
你可以使用以下凭据验证以下节点:
🌐 You can use these credentials to authenticate the following nodes:
先决条件(Prerequisites)#
- 在 MongoDB 服务器上创建具有适当权限的用户账户。
- 作为项目所有者,将所有 n8n IP 地址 添加到项目 网络访问 中的 IP 访问列表条目。有关详细说明,请参阅 添加 IP 访问列表条目。
如果你是从零开始设置 MongoDB,请创建一个集群和一个数据库。有关这些步骤的详细说明,请参阅 MongoDB Atlas 文档。
🌐 If you are setting up MongoDB from scratch, create a cluster and a database. Refer to the MongoDB Atlas documentation for more detailed instructions on these steps.
支持的身份验证方法(Supported authentication methods)#
- 数据库连接 - 连接字符串
- 数据库连接 - 值
相关资源(Related resources)#
有关该服务的更多信息,请参阅 MongoDB Atlas 文档。
🌐 Refer to the MongoDBs Atlas documentation for more information about the service.
使用数据库连接 - 连接字符串(Using database connection - Connection string)#
要配置此凭据,你需要上述列出的先决条件。然后:
🌐 To configure this credential, you'll need the Prerequisites listed above. Then:
- 将 配置类型 选择为 连接字符串。
- 输入你的 MongoDB 连接字符串。要在 MongoDB 中获取连接字符串,请前往 数据库 > 连接。
- 选择 驱动程序。
- 复制你在 将连接字符串添加到你的应用代码中 中看到的代码。它看起来会像:
mongodb+srv://yourName:yourPassword@clusterName.mongodb.net/?retryWrites=true&w=majority。 - 将连接字符串中的
<password>和<username>替换为你将使用的数据库用户的凭据。 - 在 n8n 中输入该连接字符串。
- 有关查找和格式化连接字符串的信息,请参阅连接字符串。
- 输入你的数据库名称。这是用户在连接字符串中添加详细信息时要登录的数据库名称。
- 选择是否 使用 TLS:开启以使用 TLS。你必须已将 MongoDB 数据库配置为使用 TLS,并生成 x.509 证书。在 n8n 中为这些证书字段添加信息:
- CA证书
- 公共客户端证书
- 私有客户端密钥
- 密码短语
请参阅 MongoDB 的 x.509 文档 以获取有关使用 x.509 证书的更多信息。
🌐 Refer to MongoDB's x.509 documentation for more information on working with x.509 certificates.
使用数据库连接 - 值(Using database connection - Values)#
要配置此凭据,你需要上述列出的先决条件。然后:
🌐 To configure this credential, you'll need the Prerequisites listed above. Then:
- 将 Values 选择为 配置类型。
- 输入数据库 主机 名称或地址。
- 请输入数据库名称。
- 请输入你想要登录的用户。
- 请输入用户的密码。
- 输入要连接的端口。这是你的服务器用于监听传入连接的端口号。
- 选择是否 使用 TLS:开启以使用 TLS。你必须已将 MongoDB 数据库配置为使用 TLS,并生成 x.509 证书。在 n8n 中为这些证书字段添加信息:
- CA证书
- 公共客户端证书
- 私有客户端密钥
- 密码短语
请参阅 MongoDB 的 x.509 文档 以获取有关使用 x.509 证书的更多信息。
🌐 Refer to MongoDB's x.509 documentation for more information on working with x.509 certificates.