Created on 07-23-2019 05:38 PM - edited 08-17-2019 04:38 PM
I need to do an update/upsert into Mongo.
Essentially the command that I need to run is seen in the following command (this works in the mongo command line client):
Notice in the first update I search for the document that matches the specified STDDS_DST_ID. In the second update, I match any of several Ids including the one that was already matched. In this simple example. I have a set of linked Ids: TFM_ID, FVIEW_ID, STDDS_DST_ID. The set of linked IDs is unique. For in this example that per-set distinction guarantees that you wont find STDDS_DIST_ID 100 associated with another FVIEW_ID, or TFM_ID. You'll only find it with FVIEW_ID 3000 and TFM_ID 300000.
So assuming that I have a flowfile that contains some number of fields (e.g. fld1, fld2, fl3), and one or more of the ids: TFM_ID, STDDS_DST_ID, FVIEW_ID, how can I configure PutMongo so that it will update/upsert the appropriate document (that one that matches one or more of these IDs)?
Again, in my mind, PutMongo simply needs to be configured consistent with the update you see in the image above. I just dont have much experience with PutMongo.
Looking at the documentation, I believe I must do the following:
{ $or: [{"TFM_ID": "300000"}, {"FVIEW_ID": "3000"},{"STDDS_DST_ID": "100"}]}
{$set: {"fld2": "fld2_val", "fld3": "fld3_val", "TFM_ID": "300000", "FVIEW_ID": "3000","STDDS_DST_ID": "100"}}
Are my assumptions on the mark?
Created on 07-23-2019 06:51 PM - edited 08-17-2019 04:38 PM
PutMongo does not like my $or
Created 01-09-2022 12:29 PM
Hi,
You need just to put your $or between quotes :
{
"$or":
[
{
"TFM_ID": "300000"
},
{
"FVIEW_ID": "3000"
},
{
"STDDS_DST_ID": "100"
}
]
}
Created 01-10-2022 01:24 AM
Hi @M-Boufnichel as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.
Regards,
Vidya Sargur,