Warm tip: This article is reproduced from stackoverflow.com, please click
ravendb updates ravendb-studio

Add extra column/field to RavenDB collection via RQL in Raven Studio

发布于 2020-05-11 05:25:32

I'm trying to update the entire collection by adding an extra field to each entity. This doesn't do the trick:

from things 
as t
update 
{
    put( id(t), "NewField");
}

Can someone help out with the syntax please ?

Thanks !

Questioner
Hiro Protagonist
Viewed
59
Danielle 2020-02-27 00:38

Just do:

from things as t
update {
    t.nameOfNewField = "valueOfNewField"
}

See:

https://ravendb.net/learn/inside-ravendb-book/reader/4.0/2-zero-to-ravendb#patching-documents