Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

getMongo/mongoRecord Question


getMongo/mongoRecord Question

New Contributor

Hi. I'm trying to receive a request from a handleHttpRequest processor, use a unique id from that processor to retrieve a document from a mongoDB, and then return that document to the customer using the HandleHttpResponse. I've tried a couple of approaches to this, but have encountered struggles with each.

1. First I tried a simple getMongo processor. I could not find a way to correlate the file that was created to the httpRequest, since it did not inherit that information from it's parent flowfile.

2. I was able to get individual fields using the LookupRecord processor and the MongoDBLookupService, which did inherit the http request information. While I could use this to build the response the customer wanted, the record they needed is already present in the correct format in the database. When I returned the record as a whole, however, I got something more like this:

{"job_data":"Document{{id=1234567899, links=[Document{{href=https... ..."}}

So, I'm not familiar with that format where embedded documents are spelled out that way. Is there a way in NiFi to translate this back into JSON?

Is there a better approach that I should be using?



Don't have an account?
Coming from Hortonworks? Activate your account here