Hibernating Rhinos Ltd
Oren Eini l CEO l Mobile: + 972-52-548-6969
Office: +972-4-622-7811 l Fax: +972-153-4-622-7811
--
HiSo i have a document with nested properties which have a namespace /etag on them, i need to update the etag as the namespace has changed.I dont really want to have to use https://ayende.com/blog/66563/ravendb-migrations-rolling-updates as ill only need to do this once so i just want to find ducuments by an etag and update that etag, so i was able to create an idex that ion the studio gives me results
public class FoosByEtag : AbstractIndexCreationTask<Listing,FoosByEtag.Result>{public class Result {public string Etag { get; set; }}public FoosByEtag(){Map = Foos => Foos.Select(x => new Result{Etag = x.HasImages ? x.Images.Select(p => AsDocument(p)["$type"].ToString()).FirstOrDefault<string>() : string.Empty,});Index(x => x.Etag, FieldIndexing.Analyzed);Sort(x => x.Etag, SortOptions.String);}}when in the studio i can that use the query like so - Etag:*myapp.Services.Contract.myoldnamespace.Image, Services.Contract* and i get results. However when i try linqpad like so
var documentQuery = session.Query<FoosByEtag.Result,FoosByEtag >().ToList().Dump();
i get"Could not convert document 4892530 to entity of type UserQuery+FoosByEtag+Result, Error resolving type specified in JSON 'myapp.Services.Contract.myoldnamespace.Image, Services.Contract'. Path 'Images[0].$type'. Could not find type 'myapp.Services.Contract.myoldnamespace.Image' in assembly 'Services.myoldnamespace.Contract, Version=1.0.0.0the closest iv gotten is
public class FoosByEtag : AbstractIndexCreationTask<FoosByEtag.Result>{public FoosByEtag(){Map = Foos => Foos.Select(x => new{Etag = AsDocument(x).Value<bool>("HasImages") ? AsDocument(x).Value<string>("Images[0].$type") : string.Empty,});Index(x => x.Etag, FieldIndexing.Analyzed);Sort(x => x.Etag, SortOptions.String);}public class Result{public string Etag { get; set; }}}
whilst this doesn't error it doesn't return results in linqpad where as studio query dosei just want to do something like
var documentQuery = session.Advanced.DocumentQuery<FoosByEtag.Result,FoosByEtag >().WhereEquals("Etag" , "myapp.Services.Contract.myoldnamespace.Image, Services.Contract").ToList()foreach(var item in documentQuery){item.Etag = "my new namespace"session.Store(item);session.SaveChanges();}is this possible ?thanksR
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.