Created 02-05-2019 10:15 PM
I am trying to insert a document into mongodb using apache NiFi. I want to insert a document just from Flow File attributes but not the Flow File content.
I have tried using PutMongo processor but it insert the content of the Flow file which I don't want it to insert. I need to insert a custom document by using the flow file's attributes.
Created 02-06-2019 01:28 PM
There are several processors you can use to write the attributes values to the content of the FlowFile which you can then send using putMongo processor. Here are a few examples
-
ReplaceText processor - You can use this to replace all content with the values from one or more FlowFile attributes using the NiFi expression language in the "Replacement Value" configuration property and the "Always replace" configuration option.
-
AttributesToJson processor - You use a Java regular expression to identify which FlowFile attributes will be used to generate json content and destination configuration of "flowfile content".
-
AttributesToCSV processor - You use a Java regular expression to identify which FlowFile attributes will be used to generate csv content and destination configuration of "flowfile content".
-
*** Link to details on NiFi Expression Language:
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
-
Thank you,
Matt
-
If you found this answer addressed your question, please take a moment to login in and click the "ACCEPT" link.
Created 02-06-2019 01:28 PM
There are several processors you can use to write the attributes values to the content of the FlowFile which you can then send using putMongo processor. Here are a few examples
-
ReplaceText processor - You can use this to replace all content with the values from one or more FlowFile attributes using the NiFi expression language in the "Replacement Value" configuration property and the "Always replace" configuration option.
-
AttributesToJson processor - You use a Java regular expression to identify which FlowFile attributes will be used to generate json content and destination configuration of "flowfile content".
-
AttributesToCSV processor - You use a Java regular expression to identify which FlowFile attributes will be used to generate csv content and destination configuration of "flowfile content".
-
*** Link to details on NiFi Expression Language:
https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
-
Thank you,
Matt
-
If you found this answer addressed your question, please take a moment to login in and click the "ACCEPT" link.
Created 04-22-2020 08:37 AM
Can anyone share screenshot of the processor configuration to understand this solution.