Sim

MongoDB

连接到 MongoDB 数据库

使用说明

连接到任何 MongoDB 数据库以执行查询、管理数据和执行数据库操作。支持查找、插入、更新、删除和聚合操作,并提供安全的连接处理。

工具

mongodb_query

在 MongoDB 集合上执行查找操作

输入

参数类型必需描述
hoststringMongoDB 服务器主机名或 IP 地址
portnumberMongoDB 服务器端口 (默认值:27017)
databasestring要连接的数据库名称
usernamestringMongoDB 用户名
passwordstringMongoDB 密码
authSourcestring认证数据库
sslstringSSL 连接模式 (禁用、必需、优先)
collectionstring要查询的集合名称
querystring作为 JSON 字符串的 MongoDB 查询过滤器
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
MongoDB