PutMongoBulkOperations

文档中心 › 组件索引 › PutMongoBulkOperations

PutMongoBulkOperations Processor

类型全限定名:cn.org.acal.lynxus.processors.mongodb.PutMongoBulkOperations

所属 Bundle:cn.org.acal.lynxus:lynxus-mongodb-nar:2.11.8

描述

将 FlowFile 的内容作为批量更新写入 MongoDB

标签

mongodbinsertupdatewriteputbulk

属性

下表中,加粗的属性为必填项;其余为可选项。表格同时标注默认值、是否支持表达式语言,以及是否为敏感属性(值会被加密)。

名称默认值可选值描述
Client Service控制器服务 API:
MongoDBClientService
cn.org.acal.lynxus-lynxus-mongodb-client-service-api-nar-2.11.8
如果配置,此属性将使用分配的客户端服务进行连接池。
Mongo Database Name要使用的数据库的名称
支持表达式语言:是(使用 FlowFile 属性与环境/系统变量求值)
Mongo Collection Name要使用的集合的名称
支持表达式语言:是(使用 FlowFile 属性与环境/系统变量求值)
Orderedtrue
  • true
  • false
批量写入的有序执行并在错误时中断 - 否则任意顺序并在错误时继续
Character SetUTF-8数据编码所用的字符集

关系 (Relationships)

名称描述自动终止
failure所有无法写入 MongoDB 的 FlowFile 都会路由到此关系否
success所有写入 MongoDB 的 FlowFile 都会路由到此关系否

状态管理

该组件不存储状态。

受限 (Restricted)

该组件不受限。

输入要求

该组件要求有传入连接。

系统资源考量

资源描述
MEMORYAn instance of this component can cause high usage of this system resource. Multiple instances or high concurrency settings may result a degradation of performance.

详细说明

PutMongoBulkOperation

说明

该 Processor 对 MongoDB 集合执行批量更新。FlowFile 内容应为 db.collection.bulkWrite 手册 中描述的批量写操作 JSON 数组。

可以使用其中描述的所有(目前 6 个)操作符。FlowFile 内容原样 返回。可以把许多操作合并为一个,获得显著的性能提升。

示例

以下示例 FlowFile 内容做了两件事:插入一个新文档,并更新所有 hey 值大于零的文档。

[
  {
    "insertOne": {
      "document": {
        "ho": 42
      }
    }
  },
  {
    "updateMany": {
      "filter": {
        "hey": {
          "$gt": 0
        }
      },
      "update": {
        "$inc": {
          "hey": 2
        }
      }
    }
  }
]