Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Below is a simple sample application that shows you the patching Metadata. While your example is a little different this should be a good starting point</p> <pre><code>namespace SO19941925 { internal class Program { private static void Main(string[] args) { IDocumentStore store = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "SO19941925" }.Initialize(); using (IDocumentSession session = store.OpenSession()) { for (int i = 0; i &lt; 10; i++) { session.Store(new User {Name = "User" + i}); } session.SaveChanges(); } using (IDocumentSession session = store.OpenSession()) { List&lt;User&gt; users = session.Query&lt;User&gt;().Customize(x =&gt; x.WaitForNonStaleResultsAsOfNow()).ToList(); Console.WriteLine("{0} SO19941925.Users", users.Count); } Operation s = store.DatabaseCommands.UpdateByIndex("Raven/DocumentsByEntityName", new IndexQuery {Query = "Tag:Users"}, new ScriptedPatchRequest { Script = @"this['@metadata']['Raven-Clr-Type'] = 'SO19941925.Models.User, SO19941925';" }, true ); s.WaitForCompletion(); using (IDocumentSession session = store.OpenSession()) { List&lt;Models.User&gt; users = session.Query&lt;Models.User&gt;().Customize(x =&gt; x.WaitForNonStaleResultsAsOfNow()).ToList(); Console.WriteLine("{0} SO19941925.Models.Users", users.Count); } Console.ReadLine(); } } internal class User { public string Name { get; set; } } } namespace SO19941925.Models { internal class User { public string Name { get; set; } } } </code></pre> <p>UPDATE: Based on the initial answer above, here is the code that actually solves the OP question:</p> <pre><code>store.DatabaseCommands.UpdateByIndex("Raven/DocumentsByEntityName", new IndexQuery {Query = "Tag:Users"}, new ScriptedPatchRequest { Script = @"this['OAuthAccounts']['$type'] = 'System.Collections.ObjectModel.Collection`1[ [Friendorsement.Domain.Membership.IFlexOAuthAccount, Friendorsement.Domain]], mscorlib';", }, true ); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload