Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Read mongoDB request

Hi,

i want to read mongoDB request but it don't work, i have errors.

The mongoDB request is aggregate type and complex :

 

db.lines.aggregate([
{"$match" :{billrun:"201707", type:"flat"}},
{"$group" :{
"_id":{"billrun" : "$billrun", "compte" : "$aid", "service" :"$sid"},
"billrun":{"$max":"$billrun"},
"compte": {"$max":"$aid"},
"service":{"$max":"$sid"},
"totalAmount":{"$sum":"$aprice"} }},
{$project :{_id:1, "facture":'$billrun', "compte":'$compte', "service":"$service","totalAmount":'$totalAmount'}}]).map(function(doc){
return( doc.facture + ";" + doc.compte + ";" + doc.service + ";" + doc.totalAmount );
})

the request, in RoboMongo, returns a result like this : 

"201707;58718520;150091;49.67",
"201707;983491;27274;49.197"

 

job is easy : tMongoDBConnection(it work) ---> tMongoDBInput(error) ---> tLogRow

For surrond strings with single quotes, how can i write whitout error my request ? I tried this : but it dont work.

 

The request in "Aggregation Stages tab" line is :

"{'$match' :{billrun:'201707', type:'flat'}},{'$group' :{'_id':{'billrun' : '$billrun', 'compte' : '$aid', 'service' :'$sid'},'billrun':{'$max':'$billrun'},'compte': {'$max':'$aid'},'service':{'$max':'$sid'},'totalAmount':'$sum':'$aprice'} }},{$project :{_id:1, 'facture':'$billrun', 'compte':'$compte', 'service':'$service','totalAmount':'$totalAmount'}}"

I have "Index cannot be resolved", "syntax error on tokens, delete these tokens"

 

schema of tMongoDbInput component is : 

facture (dBColumn : facture) (string)

compte (dBColumn :compte) (string)

service (dBColumn :service) (string)

totalAmount(dBColumn :totalAmount) (string)

 

thanks

 

 

 

Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hello,

Could you please post your component setting screenshots on forum which will be helpful for us to address your issue.

Please mask your sensitive data.

Best regards

Sabrina

Anonymous
Not applicable
Author

0683p000009LvtI.png

 

 

a screenshoot 0683p000009MACn.png