import xml.etree.ElementTree as ET from subdir import service from bson.objectid import ObjectId from pymongo import MongoClient import asyncio client = MongoClient() db = client["dinge"] collection = db["de-collection"] for post in collection.find(): h = post['DEBH'] hit = 0 for i in range(len(h)): if h[i] == '-': hit = hit + 1 if hit == 2: print(h) print(post['parent'])