I have a RavenDB with some collections and about 30 indexes.
I'm trying to perform some mass updates in a specific collection (Profiles) via DatabaseCommands.UpdateByIndex and a PatchRequest, actually my code is something like this:
db.DatabaseCommands.UpdateByIndex("Profiles/ByFinder", new
Raven.Abstractions.Data.IndexQuery { }, new [] { new PatchRequest {
Type = PatchCommandType.Unset, Name = "CreatedById" } });
Where "Profiles/ByFinder" is an index that works on this specific collection.
The strange thing is that ALL the indexes in the DB go in stale state as I perform this command, even the indexes that don't work with the Profiles collection in any way.
Is that the default behaviour, and if so, there's a way to avoid it?
That is by design, whenever you modify a document, all documents are stale until they can verify that this document isn't related to them.