I am trying to remove a property (whose addition to the documents I asked for help with, see here ), using RavenDB Studio (I accidentally added them to the wrong database collection...).
Again, I'm stuck on the syntax. Also - I can't believe nobody has had the intention of doing this until now - at least intense googling couldn't produce anything useful. The official documentation is also terse on this subject, to say the least. Aside: Why is DDL in RavenDB (and presumably other NoSQL DBs) so cumbersome ?
I tried various versions of
from things as t
update {
delete t.field
}
none of which work, and some of them don't even compile.
With Patching - removing a document field can be done this way from the Client code:
Single document:
session.Advanced.Defer(new PatchCommandData(
id: "yourDocumentID",
changeVector: null,
patch: new PatchRequest
{
Script = @"delete this.fieldToDelete"
},
patchIfMissing: null));
session.SaveChanges();
See: Patching - Removing Property
Multiple documents:
var operation = store
.Operations
.Send(new PatchByQueryOperation("from things update { delete this.field; }"));
operation.WaitForCompletion();
Example was taken from here
For RQL simply use:
from things
update {
delete this.field;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With