MarkLogic version : 9.0-6.2
I am using MLCP to ingest documents into STAGING DB. For each document in STAGING DB, I need to update multiple documents in the FINAL DB.
For example, the staging DB document has email with a bounce back indicator. I need to update bounce back indicator in all documents in a collection in FINAL that has the same email id.
Can I use Harmonize flow to do this? How can I code in content.sjs to call writer.sjs multiple times?
I tried to use a loop in writer.sjs to return each document in FINAL and apply documentInsert (basically, a FOR loop in writer.sjs), but the behavior is not consistent. Also, I am not sure if this is the right usage of Harmonize flow.
I tried to write custom code and invoke through REST API call. This is working as expected.
Please suggest the best way to handle my requirement (Harmonize Vs Custom REST).