MongoDB nested object aggregation counting
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a highly nested mongoDB set of objects and I want to count the number of subdocuments that match a given condition Edit: (in each document) . For example: {"_id":{"chr":"20","pos":"14371","ref":"A","alt":"G"}, "studies":[ { "study_id":"Study1", "samples":[ { "sample_id":"NA00001", "formatdata":[ {"GT":"1|0","GQ":48,"DP":8,"HQ":[51,51]} ] }, { "sample_id":"NA00002", "formatdata":[ {"GT":"0|0","GQ":48,"DP":8,"HQ":[51,51]} ] } ] } ] } {"_id":{"chr":"20","pos":"14372","ref":"T","alt":"AA"}, "studies":[ { "study_id":"Study3", "samples":[ {