I'm new to Azure DocumentDB, and I've immediately run into a problem while trying it out. On the first save in an empty collection, I get the following error:
ResourceType Document is unexpected.
ActivityId: 29619975-e55a-4f31-a3d1-73d180ba3932
My repository code (partial) is as follows:
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);
}
}
This is the first time anything has ever been written to this database/collection. Am I doing something wrong?
UpsertDocumentAsync should take the DocumentCollection link, instead of Document link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With