Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I used below query in tmongodbinnput and it worked fine.
"{'$group':{'_id' : {'name':'$product.name','id':'$product.onairId'}, 'total' : {'$max' : '$prgDate'}}}"
But now I am using
"{'$unwind': {'path' : '$grid'}},{'$group' :{'_id':'$grid.product.name','total':{'$max':'$dealCreatedAt'}}"
and it is not throwing any error, but it is just unwinding and returning all documents instead of grouping them.
Can anyone please tell how to unwind an array of objects and then do a group and find max of something?
Regards
Ravinder
I found the solution after many trials.
I just used 2 stages by specifically adding 2 stages in tmongoInput aggregation pipeline mode.
stage 1 : "{$unwind : {path : '$grid'}}"
stage 2 : "{$group : {_id : '$grid.product.name','total': {$max : '$dealCreatedAt'}}}"
I found the solution after many trials.
I just used 2 stages by specifically adding 2 stages in tmongoInput aggregation pipeline mode.
stage 1 : "{$unwind : {path : '$grid'}}"
stage 2 : "{$group : {_id : '$grid.product.name','total': {$max : '$dealCreatedAt'}}}"
Hi when i try to run query:-
"{'$group':{'_id' : {'_wellname':'$_wellname','_datasetname':'$_datsetname','_variablename':'$_variablename'}, 'total' : {'$sum' : 1}}}"
i get only count ,all columns are blank in output file.
I want count by column name passed in my query