how to find a sum using linq in a bson document using C# -


the sample collections structure :-

{  arr : [        { "seq" : 2 },        { "seq" : 4 }        ] } 

the c# code tried is

var maxticketseq = bsontrans["arr"].asbsonarray.sum(m => (int)m["seq"]); 

this working fine...

but structure

{ "arr" : [   { "name" : [{"seq" : 2 } , {"seq" : 5 }] },  { "name" : [{"seq" : 2 } , {"seq" : 5 }] }  } 

for need find sum of seq.

how achieve in linq query.

actually bsondocument similar 1 getting result of mongo query.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -