RavenDB : access to database instance during document conversion
===

I need some help about Raven DB and its C# API.
I want to do an “order by” with a Linq query (with the Linq to Raven implementation). To do so I have to create an index to realize this action. My schema is currently normalized, but I want to denormalize it in order to add a custom property in it.

So, I have :

Entity A :

 - Some property
 - The Id of a B entity

In fact, I simply want to order my As by a B property. So I want to denormalize my A to include the B property.

So a scheme evolution is possible with RavenDB, but in order to set the B property in A I have to load the B when converting the A. And it seems impossible according to the documentation.

I don’t want to build a creepy program that will iterate on each A to load Bs but I don’t see another solution.

Any idea ?

Thank you for your time :).
Julien