After playing around with it some more, doing
if(this.ShowMember == undefined)
seems to work.
Both
if(this.ShowMember == null)
and
if(!this.ShowMember)
don't work.
Question
I have Documents like this in RavenDB 2.5:
public class SomeDocument {
public int Id { get;set; }
...other properties...
public bool ShowMember { get;set; }
}
with the ShowMember
property being newly added.
Now I want to set ShowMember
to true
on all documents where it isn't set already.
I tried doing this with Eval Patching like this:
store.DatabaseCommands.UpdateByIndex("Raven/DocumentsByEntityName",
new IndexQuery { Query = "Tag:SomeDocuments" },
new ScriptedPatchRequest() {
Script = @"if(this.ShowMember == null){
this.ShowMember = true;
}" });
the operation completes without any errors, but documents that already have ShowMember
set are still updated, despite the if
La solution
After playing around with it some more, doing
if(this.ShowMember == undefined)
seems to work.
Both
if(this.ShowMember == null)
and
if(!this.ShowMember)
don't work.