[英]XQuery update for document with versions
I am trying to update value of some property in xDB using XQuery, here is my transaction: 我正在尝试使用XQuery更新xDB中某些属性的值,这是我的事务:
let $source := doc('/historicalresource')/HistoricalResourceData[id/@UUID = '0361513e-30fa-45e4-a73a-d05870b8a284']
let $res := $source/ResourceProperty[@PropertyName="cpu|limit"]/@PropertyValue
let $change := '21572'
return replace value of node $res with $change
After running this query I receive such error: 运行此查询后,我收到这样的错误:
com.xhive.error.XhiveException: VERSION_ACCESS_DENIED: This document is versioned and can only be changed through a versioning operation
com.xhive.error.XhiveException:VERSION_ACCESS_DENIED:本文档已版本化,只能通过版本化操作进行更改
Indeed in my case historicalresource
is a folder which may contain more than one document and all they have a version, like: v1.1 ,v1.2, etc.. 实际上,在我的情况下,
historicalresource
是一个文件夹,其中可能包含多个文档,并且所有文档都有一个版本,例如:v1.1,v1.2等。
How can I update the value of last version using xquery? 如何使用xquery更新最新版本的值? How should I modify my query to be able to update desired value ?
我应该如何修改查询以更新所需的值?
Finally, I have found the answer to my question, therefore adding it here: 最后,我找到了问题的答案,因此在这里添加:
There is no way to update xDB file using xQuery as it is version based system and xQuery cannot create a new version, but it could be done manually or automatically by some coding language (for example: java): 无法使用xQuery更新xDB文件,因为它是基于版本的系统,并且xQuery无法创建新版本,但是可以通过某种编码语言(例如:java)手动或自动完成:
对于版本化的文档(在其上XhiveLibraryChildIf.makeVersionable()
的情况),确实是这种情况:您必须先检出文档,然后对检出的副本运行更新查询,最后检入新版本。非版本化文档,但是,您可以直接应用更新查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.