Examples of documents:
{
"_id": {
"$oid": "6175f6e5f2363e1cc9aa5835"
},
"#CHROM": 1,
"POS": 286747,
"ID": "rs369556846",
"REF": "A",
"ALT": "G",
"QUAL": ".",
"FILTER": ".",
"INFO": [{
"RS": 369556846,
"RSPOS": 286747,
"dbSNPBuildID": 138,
"SSR": 0,
"SAO": 0,
"VP": "0x050100000005150026000100",
"WGT": 1,
"VC": "SNV",
"CAF": [{
"$numberDecimal": "0.9381"
}, {
"$numberDecimal": "0.0619"
}],
"COMMON": 1,
"TOPMED": [{
"$numberDecimal": "0.88411856523955147"
}, {
"$numberDecimal": "0.11588143476044852"
}]
},
["SLO", "ASP", "VLD", "G5", "KGPhase3"]
]
}
{
"_id": {
"$oid": "6175f6e5f2363e1cc9aa583b"
},
"#CHROM": 1,
"POS": 911220,
"ID": "rs35331099",
"REF": "CT",
"ALT": "C",
"QUAL": ".",
"FILTER": ".",
"INFO": [{
"RS": 35331099,
"RSPOS": 911221,
"dbSNPBuildID": 130,
"SSR": 0,
"SAO": 0,
"VP": "0x05010008000517013e000200",
"GENEINFO": "LOC284600:284600",
"WGT": 1,
"VC": "DIV",
"CAF": [{
"$numberDecimal": "0.2492"
}, {
"$numberDecimal": "0.7508"
}],
"COMMON": 1,
"TOPMED": [{
"$numberDecimal": "0.21621750764525993"
}, {
"$numberDecimal": "0.78378249235474006"
}]
},
["RV", "SLO", "INT", "ASP", "VLD", "G5A", "G5", "GNO", "KGPhase1", "KGPhase3"]
]
}
Task:
get the values of the INFO.0.VC field in a unique form.
PyMongo query:
sep_vals = [doc for doc in src_coll_obj.aggregate([{'$group': {'_id': 'null', 'spl_field': {'$addToSet': '$INFO.0.VC'}}}])][0]['spl_field']
Expected result:
['SNV', 'DIV']
The result obtained:
empty two-dimensional array.
Question:
Is there an error in the query? Or is it a MongoDB bug?