View for checking repository name is unique

def repository_name(doc):
    """View for checking repository name is unique"""
    for repository_id, repo in doc.get('repositories', {}).items():
        repo['id'] = repository_id
        repo['organisation_id'] = doc['_id']

        name = repo.get('name', None)
        if name:
            yield name, repository_id