Posted under » MongoDB on 29 August 2024
To count embedded objects use the len method. After you get the len then you can iterate.
myquery = { "cid" : 2118 } for x in mthlog.find(myquery): howmany = len(x["band-06"]) print(howmany) for i in range(howmany): pprint.pprint(x["band-06"][i]['band'])