1

In my NiFi workflow,I configured a getMongo Processor along with query property .

my query is working fine and I am getting back the response from MongoDB in Ni-Fi as shown below

{ "_id" : { "$oid" : "5dcadc91f027705b1834d6c5" }, "empId" : "333-44-6J", "accountId" : "444434D2", "fulltimeEmployee" : "true", "DateJoined" : "07/14/2016 11:37:42", "Bloddgroup" : "null" }

I want to route DateJoined,Bloodgroup etc fields for further processing.

How do I access these fields once we have the response available in getMongo processor.

I tired to use Processors like RouteonAttribute and UpdateAttribute and trying to access DateJoined using "${DateJoined}" .but I am getting null value.

enter image description here

praveen sangalad
  • 338
  • 2
  • 14

2 Answers2

1

Use EvaluateJsonPath and configure dynamic property DateJoined set as $.DateJoined and Bloodgroup set as $.Bloodgroup. This will extract these json properties into FlowFile attributes and will allow you to address them as you did using expression language(${Bloodgroup} and ${DateJoined})

Ben Yaakobi
  • 1,620
  • 8
  • 22
1

Only attributes can be accessed using $ Symbol, since DB records are not attributes, you need to use EvaluateJsonPath processor as Ben mentioned and then fetch the attributes using ${DateJoined}

user4951
  • 31
  • 3