The below is what I know works for RavenDB Server 4.2 and up:
Option 1 - using static index
Create a static index ('MyIndex') with the following map method:
from i in docs.Items
select new {
Name = i.Name
}
Then query the index as follows:
Return all 'Items' that do not have 'Name':
from index 'MyIndex'
where true and not exists(Name)
Option 2 - using auto-index:
First, run the following query which will 'create' the auto-index for you:
from Items
where exists(Name)
After that, you can query the following to get results:
from Items
where true and not exists(Name)
=================================================
A patch script is made up of the query part and the update part
So use the following to add the missing property to docs that don't have it:
from Items
where true and not exists(Name)
update {
this.Name = "value"
}