In Azure DocumentDB using the .NET SDK, I get the following error when calling ReplaceDocumentAsync:
"Errors": ["Invalid input because the required properties are" id; "- none," "Invalid request payload. Make sure you provide a valid request payload."
This is a blog script when a new comment is added, I get a document, add a comment and call ReplaceDocumentAsync. Here is how I do it:
string query = "SELECT * FROM Posts p WHERE p.id = 'some guid'"; var post = Client.CreateDocumentQuery<Post>(Collection.DocumentsLink, query) .AsEnumerable().FirstOrDefault(); post.Comments.Add(comment); Document doc = Client.CreateDocumentQuery(Collection.DocumentsLink) .Where(d => d.Id == id) .AsEnumerable() .FirstOrDefault(); var document = await Client.ReplaceDocumentAsync(doc.SelfLink, item);
Publication Class:
public class Post { public Post() { Comments = new List<Comment>(); } public Guid Id { get; set; } public List<Comment> Comments { get; set; } ... }
What am I doing wrong?
source share