Closed alexmasselot closed 9 years ago
for the sequence count db.sequences.aggregate([{$group:{_id:"$source", nbEntries:{$sum : 1}}}])
db.sequences.group({key:{source:1}, initial:{nbEntries:0, nbResidues:0}, reduce:function(cur, result){result.nbEntries++; result.nbResidues+= cur.sequence.length}})
I tested into mongo and I got this:
[ { "source" : null, "nbEntries" : 2, "nbResidues" : 694 } ]
So, without the source we obtain same results:
[ { "nbEntries" : 2, "nbResidues" : 694 } ]
Could we just remove the source???
And for the reduce:function...do you have an example about how to translate into BSONDocument??
sequence source, number of entries if possible fast, number of residues