RavenDB 如何修补 JSON 个对象?
How can RavenDB patch JSON objects?
使用Raven Studio的补丁接口,我有如下补丁脚本:
this.Market = this.Market.replace("洛杉矶","Los Angeles")
删除前缀 space.
这对于具有单值字符串的字段来说没问题,但我的数据结构为 JSON 对象:
"Market": [
“ 洛杉矶”,
"Chicago",
“纽约市”],
并且 运行 补丁抛出错误,"TypeError: Object has no method 'delete'." 我该如何解决这个问题?
var m= this.Market;
for(var i=0; i < m.length; i++) {
this.Market[i] = m[i].replace("Los Angeles","Los Angeles");
}
使用Raven Studio的补丁接口,我有如下补丁脚本: this.Market = this.Market.replace("洛杉矶","Los Angeles") 删除前缀 space.
这对于具有单值字符串的字段来说没问题,但我的数据结构为 JSON 对象: "Market": [ “ 洛杉矶”, "Chicago", “纽约市”],
并且 运行 补丁抛出错误,"TypeError: Object has no method 'delete'." 我该如何解决这个问题?
var m= this.Market;
for(var i=0; i < m.length; i++) {
this.Market[i] = m[i].replace("Los Angeles","Los Angeles");
}