更新 RavenDB 中的文档 [英] Updating documents in RavenDB

查看:46
本文介绍了更新 RavenDB 中的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在持久化实体上添加、删除或重命名属性,更新 RavenDB 中文档的最简单方法是什么?

If you add, delete or rename a property on a persisted entity, what's the easiest way to update the documents in RavenDB?

推荐答案

RavenDB 支持 PATCH 命令,参见 文档 了解更多信息.这样你就可以直接更新文档,而不必从服务器拉取它,更新它然后发送回来.

RavenDB supports PATCH commands, see the docs for more info for more info. This way you can update a document directly without having to pull it from the server, update it and then send it back.

您也可以使用基于集合的查询在多个文档上运行补丁,请参阅在这里了解更多信息.这让你可以做相当于

Also you can run patches over multiple documents by using Set-based queries, see here for some more info. This lets you do the equivalent of

UPDATE Users
SET IsActive = false
WHERE LastLogin < '2010-05-10'

这篇关于更新 RavenDB 中的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆