问题
Is there a way to update part of a document in a DocumentDB collection?
I know that ReplaceDocumentAsync
lets you update a document, but you have to replace the entire document. This sounds kind of scary. If I have an object that has other objects nested I will have to query for the parent document and then replace the entire document to update a nested part of the object.
Does DocumentDB handle ReplaceDocumentAsync
in a way that makes it perform better than it might seem on the surface?
回答1:
Unfortunately, as of now, this is not possible. You can vote up the suggestion on the Microsoft Azure User Voice page.
http://feedback.azure.com/forums/263030-documentdb/suggestions/6693091-be-able-to-do-partial-updates-on-document
More Information
Scott Guthrie's Blog: http://weblogs.asp.net/scottgu/azure-new-documentdb-nosql-service-new-search-service-new-sql-alwayson-vm-template-and-more
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/822d4b5c-13ce-4737-a1e9-6217851dfa9c/update-delete-parts-of-an-documentdb-object-graph-how-do-weak-relations-work?forum=AzureDocumentDB
Here is a comment from a Microsoft employee, stating that support for partial document updates will be added in a future update:
http://blogs.msdn.com/b/documentdb/archive/2014/08/22/introducing-azure-documentdb-microsoft-s-fully-managed-nosql-document-database-service.aspx

来源:https://stackoverflow.com/questions/29136834/updating-part-of-a-document-in-azure-documentdb