Created on 07-24-2019 05:57 PM - edited 08-17-2019 04:36 PM
I have a sequence of flowfiles that I need to put to mongo. A sample is at the bottom of this question. The flowfile contains JSON with a field "evt_data": {"stdds_id": "stdds_id_value" ..
I need that stdds_id_value to be the key for update/upsert into mongo. I'm looking for help with the flow configuration that will make this work.
My current PutMongo (non-working attempt) configuration is this:
I'm trying to put a record that is keyed on the evt_data.stdds_id value as see in the following flowfile JSON:
In other words the key for the document in Mongo would be
"TARGET-STDDS-KCLT-157481920517"
This doesnt work, and I end up seeing multiple documents in mongo for that same key. I should only see one per distinct key.
What is the proper way to set the update key?
Created on 07-24-2019 07:16 PM - edited 08-17-2019 04:35 PM
By the way, (if I need to) I am able to use EvaluateJSONPath to extract the stdds_id and place it as an attribute on the flowfile (see STDDS_ID) :
Id use STDDS_ID as the key into mongo, but I'm not sure how to add this to the flowfile content, so that I can update/upsert using this key.
Created on 07-24-2019 07:29 PM - edited 08-17-2019 04:35 PM
I've verified that if the key is set to a field that is in the root level of my JSON then I am able to update/upsert properly.
For example, I tried this with the evt_type field:
This worked fine. So my only question is how do I handle a field that is one level down in the JSON
as is the case with stdds_id
{"evt_data": {"stdds_id": "stdds_id_value" , ...}}
Created 04-16-2020 01:16 PM
Hi
for this flow
can you share what was teh content of the flow file. and what was the configuration in put mongo.
I am facing the same issues.
Thanks
Rupesh