Sim

MongoDB

连接到 MongoDB 数据库

MongoDB 工具使您能够连接到 MongoDB 数据库,并直接在您的代理工作流中执行各种面向文档的操作。通过灵活的配置和安全的连接管理,您可以轻松地与数据交互并对其进行操作。

使用 MongoDB 工具,您可以:

  • 查找文档:使用 mongodb_query 操作,通过丰富的查询过滤器查询集合并检索文档。
  • 插入文档:使用 mongodb_insert 操作,将一个或多个文档添加到集合中。
  • 更新文档:通过指定过滤条件和更新操作,使用 mongodb_update 操作修改现有文档。
  • 删除文档:使用 mongodb_delete 操作,从集合中删除文档,指定过滤器和删除选项。
  • 聚合数据:使用 mongodb_execute 操作运行复杂的聚合管道,以转换和分析数据。

MongoDB 工具非常适合需要管理或分析结构化、基于文档的数据的工作流。无论是处理用户生成的内容、管理应用数据,还是支持分析,MongoDB 工具都能以安全、编程化的方式简化您的数据访问和操作。

使用说明

将 MongoDB 集成到工作流中。可以查找、插入、更新、删除和聚合数据。

工具

mongodb_query

在 MongoDB 集合上执行查找操作

输入

参数类型必需描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、首选)
collectionstring要查询的集合名称
querystringMongoDB 查询过滤器(JSON 字符串)
limitnumber要返回的文档最大数量
sortstring排序条件(JSON 字符串)

输出

参数类型描述
messagestring操作状态消息
documentsarray查询返回的文档数组
documentCountnumber返回的文档数量

mongodb_insert

将文档插入到 MongoDB 集合中

输入

参数类型必需描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认值:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、优先)
collectionstring要插入的集合名称
documentsarray要插入的文档数组

输出

参数类型描述
messagestring操作状态消息
documentCountnumber插入的文档数量
insertedIdstring插入文档的 ID (单个插入)
insertedIdsarray插入文档的 ID 数组 (多个插入)

mongodb_update

更新 MongoDB 集合中的文档

输入

参数类型必填描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认值:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、优先)
collectionstring要更新的集合名称
filterstring过滤条件(JSON 字符串)
updatestring更新操作(JSON 字符串)
upsertboolean如果未找到则创建文档
multiboolean更新多个文档

输出

参数类型描述
messagestring操作状态消息
matchedCountnumber符合过滤条件的文档数量
modifiedCountnumber被修改的文档数量
documentCountnumber受影响的文档总数
insertedIdstring插入文档的 ID (如果是 upsert)

mongodb_delete

从 MongoDB 集合中删除文档

输入

参数类型必填描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认值:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、优先)
collectionstring要删除的集合名称
filterstring过滤条件(JSON 字符串)
multiboolean删除多个文档

输出

参数类型描述
messagestring操作状态消息
deletedCountnumber删除的文档数量
documentCountnumber受影响的文档总数

mongodb_execute

执行 MongoDB 聚合管道

输入

参数类型必填描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认值:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、优先)
collectionstring要执行管道的集合名称
pipelinestring聚合管道(JSON 字符串)

输出

参数类型描述
messagestring操作状态消息
documentsarray从聚合返回的文档数组
documentCountnumber返回的文档数量

注意事项

  • 类别:tools
  • 类型:mongodb
On this page

On this page

Start building today
Trusted by over 60,000 builders.
Build Agentic workflows visually on a drag-and-drop canvas or with natural language.
Get started