ResourceType 文档在 UpsertDocumentAsync() 时出现意外

ResourceType Document is unexpected at UpsertDocumentAsync()

我是 Azure DocumentDB 的新手,在尝试时我立即 运行 遇到了问题。在空集合中第一次保存时,出现以下错误:

ResourceType Document is unexpected.

ActivityId: 29619975-e55a-4f31-a3d1-73d180ba3932

我的仓库代码(部分)如下:

public interface IEntity
{
    string Id { get; set; }
    DateTime DbCreatedAt { get; set; }
    DateTime DbLastUpdatedAt { get; set; }
}

public class Repository<T>: IRepository<T> where T: class, IEntity
{
    private DocumentClient _documentClient;
    private string _databaseName;
    private string _collectionName;

    // ....
    // ....

    public Task SaveAsync(T entity)
    {
        var documentUri = UriFactory.CreateDocumentUri(_databaseName, _collectionName, entity.Id);
        return _documentClient.UpsertDocumentAsync(documentUri, entity);
    }
}

这是第一次向此 database/collection 写入任何内容。我做错了什么吗?

UpsertDocumentAsync 应该采用 DocumentCollection link,而不是 Document link。