def _get_subcollections(collection):
 for name in collection.database.collection_names():
  cleaned = name[:name.rfind('.')]
  if ((cleaned != collection.name) and cleaned.startswith(collection.name)):
   (yield cleaned)

def _get_subcollections ( collection ) : for name in collection . database . collection_names ( ) : cleaned = name [ : name . rfind ( '.' ) ] if ( ( cleaned != collection . name ) and cleaned . startswith ( collection . name ) ) : ( yield cleaned )
returns all sub-collections of collection .