Query tangled array in Pymongo
问题 I am trying to query a very tangled collection. The schema: {'tags': {'variables': [{'value': '3x9', 'var_name': 's'}, {'value': '12:00AM', 'var_name': 'x'}, {'value': 'goog', 'var_name': 'y'}]}, 'url': 'https://www.google.com'}] The Query: res = mycol.aggregate([{"$unwind":"$tags"} ,{'$match': {'tags.tag.name':'A A', 'aR': 98765}} ,{'$project': {'url': 1, 'tags.vars': 1, '_id': 0}},]) res = list(res) for x in res: print(res) The Result: {'tags': {'variables': [{'value': '3x9', 'var_name': 's