从RavenDB Studio中的集合中删除字段
我正在尝试使用RavendBStudio删除一个属性(其添加到我请求帮助的文档中,请参见)(我不小心将它们添加到了错误的数据库集合…) 再一次,我被语法卡住了。而且——我不敢相信,直到现在还没有人打算这么做——至少谷歌搜索无法产生任何有用的结果。至少可以说,官方文件在这个问题上也很简洁。 旁白:为什么RavenDB(可能还有其他NoSQL数据库)中的DDL如此麻烦 我尝试了不同版本的从RavenDB Studio中的集合中删除字段,ravendb,ravendb-studio,Ravendb,Ravendb Studio,我正在尝试使用RavendBStudio删除一个属性(其添加到我请求帮助的文档中,请参见)(我不小心将它们添加到了错误的数据库集合…) 再一次,我被语法卡住了。而且——我不敢相信,直到现在还没有人打算这么做——至少谷歌搜索无法产生任何有用的结果。至少可以说,官方文件在这个问题上也很简洁。 旁白:为什么RavenDB(可能还有其他NoSQL数据库)中的DDL如此麻烦 我尝试了不同版本的 from things as t update { delete t.field } 所有这些都不
from things as t
update {
delete t.field
}
所有这些都不起作用,有些甚至无法编译。使用补丁-可以通过这种方式从客户机代码中删除文档字段: 单个文档:
session.Advanced.Defer(new PatchCommandData(
id: "yourDocumentID",
changeVector: null,
patch: new PatchRequest
{
Script = @"delete this.fieldToDelete"
},
patchIfMissing: null));
session.SaveChanges();
var operation = store
.Operations
.Send(new PatchByQueryOperation("from things update { delete this.field; }"));
operation.WaitForCompletion();
from things
update {
delete this.field;
}
见:
多个文档:
session.Advanced.Defer(new PatchCommandData(
id: "yourDocumentID",
changeVector: null,
patch: new PatchRequest
{
Script = @"delete this.fieldToDelete"
},
patchIfMissing: null));
session.SaveChanges();
var operation = store
.Operations
.Send(new PatchByQueryOperation("from things update { delete this.field; }"));
operation.WaitForCompletion();
from things
update {
delete this.field;
}
例子取自
对于RQL,只需使用:
session.Advanced.Defer(new PatchCommandData(
id: "yourDocumentID",
changeVector: null,
patch: new PatchRequest
{
Script = @"delete this.fieldToDelete"
},
patchIfMissing: null));
session.SaveChanges();
var operation = store
.Operations
.Send(new PatchByQueryOperation("from things update { delete this.field; }"));
operation.WaitForCompletion();
from things
update {
delete this.field;
}