Skip to main content

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​

insert, mongodb, put, record, update, upsert

Properties​

In the list below required Properties are shown with an asterisk (*). Other properties 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:
MongoDBClientService

Implementations:
MongoDBControllerService
If configured, this property will use the assigned client service for connection pooling.
Mongo Database Name *Mongo Database NameThe name of the database to use

Supports Expression Language, using FlowFile attributes and Environment variables.
Mongo Collection Name *Mongo Collection NameThe name of the collection to use

Supports Expression Language, using FlowFile attributes and Environment variables.
Record Reader *record-readerController Service:
RecordReaderFactory

Implementations:
AvroReader
CEFReader
CSVReader
ExcelReader
GrokReader
JsonPathReader
JsonTreeReader
ReaderLookup
ScriptedReader
Syslog5424Reader
SyslogReader
WindowsEventLogReader
XMLReader
YamlTreeReader
Specifies the Controller Service to use for parsing incoming data and determining the data's schema
Batch Size *insert_count100The number of records to group together for one single insert/upsert operation against MongoDB.
Ordered *orderedFalse
  • True
  • False
Perform ordered or unordered operations
Bypass Validation *bypass-validationFalse
  • True
  • False
Enable or disable bypassing document schema validation during insert or update operations.
Bypassing document validation is a Privilege Action in MongoDB.
Enabling this property can result in authorization errors for users with limited privileges.
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
  • Update Many
  • Use 'mongodb.update.mode' FlowFile attribute.
Choose between updating a single document or multiple documents per incoming record.

This property is only considered if:
  • the property Update Key Fields has a value specified

Dynamic Properties​

This component does not support dynamic properties.

Relationships​

NameDescription
failureAll FlowFiles that cannot be written to MongoDB are routed to this relationship
successAll FlowFiles that are 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​

This processor does not write attributes.

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​

This component does not specify system resource considerations.

See Also​