Unable to use context variable in query for MongoDB

Four Stars

Unable to use context variable in query for MongoDB

Hi All,

I have created one context group and when i use it directly in query in tMongoDBInput,it works fine,but when i am setting context variable values in tJavaFlow and using again in tMongoDBInput,then it does not work.

Below code used in tJavaFlow:-

String wellfile = input_row.Well;

context.well=wellfile;

 

 

Twelve Stars

Re: Unable to use context variable in query for MongoDB

You have not any relations between tJavaRow2 and tMongoDBInput components

they are independent, so no any warranty - when Input component start work - any context variable defined

 

1) manage order of components, add tDFlowToIterate if necessary for iterate for each

2) add tJava before tMongoDBInput and print context variable (same as You do in tJavaRow2) - it show You, do You have anything defined?

-----------
Four Stars

Re: Unable to use context variable in query for MongoDB

I have added tJava after tJavaFlow,and i am printing variable value in tJava,it is also displayed still i am not able to connect with tMongoDBInput.

My requirements is that i am reading row from file and storing one column values in context variable for each row in tJavaFlow,I want to use same context variable value in my mongo query,but i am not able to do

Four Stars

Re: Unable to use context variable in query for MongoDB

I have updated my job and i am getting variable in query using global var used in tJavaFlow.

But i get it only for last record processed from tMap.

I want to iterate it in my query,so that for each global var i can execute my query based on my global varibale values.

 

Four Stars

Re: Unable to use context variable in query for MongoDB

Please find attached updated Job image.

I want to use global var used in tJavaFlow for each iteration in tMongoDBinput.

Forteen Stars TRF
Forteen Stars

Re: Unable to use context variable in query for MongoDB

If you want to query your Mongo DB for each row issued from your input file, you need a tFlowToIterate to connect both subjobs.

(Don't know if this component is available in TOS for Big Data)


TRF
Twelve Stars

Re: Unable to use context variable in query for MongoDB

available, and this is what I mean above - 2 part of job do not connected

-----------
Four Stars

Re: Unable to use context variable in query for MongoDB

How should  i connect tmap,tJavaFlow,tFlowIterate,tDBMongoInput.

Right now i am not able to make connection with tMongoDBInput with tJavaFlow/tFlowIterate.

Please help me.

Twelve Stars

Re: Unable to use context variable in query for MongoDB

Your job design is wrong, this is why it not work, try something like:

Screen Shot 2018-06-12 at 5.57.20 PM.png

 

check all examples from demo projects included in each Studio

-----------