Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

What is the key to use in PutMongo to Update/Upsert

Rising Star

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


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?


Rising Star

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.

Rising Star

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" , ...}}




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.