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