PutMongoRecord

Description:

This processor is a record-aware processor for inserting/upserting data into MongoDB. It uses a configured record reader and schema to read an incoming record set from the body of a flowfile and then inserts/upserts batches of those records into a configured MongoDB collection. This processor does not support deletes. The number of documents to insert/upsert at a time is controlled by the "Batch Size" configuration property. This value should be set to a reasonable size to ensure that MongoDB is not overloaded with too many operations at once.

Tags:

mongodb, insert, update, upsert, record, put

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Client Servicemongo-client-serviceController Service API:
MongoDBClientService
Implementation: MongoDBControllerService
If configured, this property will use the assigned client service for connection pooling.
Mongo URIMongo URIMongoURI, typically of the form: mongodb://host1[:port1][,host2[:port2],...]
Supports Expression Language: true (will be evaluated using variable registry only)
Mongo Database NameMongo Database NameThe name of the database to use
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
Mongo Collection NameMongo Collection NameThe name of the collection to use
Supports Expression Language: true (will be evaluated using flow file attributes and variable registry)
SSL Context Servicessl-context-serviceController Service API:
SSLContextService
Implementations: StandardSSLContextService
StandardRestrictedSSLContextService
The SSL Context Service used to provide client certificate information for TLS/SSL connections.
Client Authssl-client-authREQUIRED
  • WANT
  • REQUIRED
  • NONE
Client authentication policy when connecting to secure (TLS/SSL) cluster. Possible values are REQUIRED, WANT, NONE. This property is only used when an SSL Context has been defined and enabled.
Write ConcernWrite ConcernACKNOWLEDGED
  • ACKNOWLEDGED
  • UNACKNOWLEDGED
  • FSYNCED
  • JOURNALED
  • REPLICA_ACKNOWLEDGED
  • MAJORITY
  • W1
  • W2
  • W3
The write concern to use
Record Readerrecord-readerController Service API:
RecordReaderFactory
Implementations: GrokReader
JsonTreeReader
WindowsEventLogReader
ReaderLookup
ParquetReader
CSVReader
Syslog5424Reader
ExcelReader
CEFReader
XMLReader
ScriptedReader
SyslogReader
JsonPathReader
AvroReader
YamlTreeReader
Specifies the Controller Service to use for parsing incoming data and determining the data's schema
Batch Sizeinsert_count100The number of records to group together for one single insert/upsert operation against MongoDB.
OrderedorderedFalse
  • True
  • False
Perform ordered or unordered operations
Bypass Validationbypass-validationTrue
  • True
  • False
Bypass schema validation during insert/upsert
Update Key Fieldsupdate-key-fieldsComma separated list of fields based on which to identify documents that need to be updated. If this property is set NiFi will attempt an upsert operation on all documents. If this property is not set all documents will be inserted.
Update Modeupdate-modeUpdate One
  • Update One Updates only the first document that matches the query.
  • Update Many Updates every document that matches the query.
  • Use 'mongodb.update.mode' flowfile attribute. Use the value of the 'mongodb.update.mode' attribute of the incoming flowfile. Acceptable values are 'one' and 'many'.
Choose between updating a single document or multiple documents per incoming record.

This Property is only considered if the [Update Key Fields] Property has a value specified.

Relationships:

NameDescription
successAll FlowFiles that are written to MongoDB are routed to this relationship
failureAll FlowFiles that cannot be written to MongoDB are routed to this relationship

Reads Attributes:

NameDescription
mongodb.update.modeConfigurable parameter for controlling update mode on a per-flowfile basis. Acceptable values are 'one' and 'many' and controls whether a single incoming record should update a single or multiple Mongo documents.

Writes Attributes:

None specified.

State management:

This component does not store state.

Restricted:

This component is not restricted.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.