public class User
{ public string Id { get; set; } public List<Tag> Tags { get; set; }}
public class Tag{ public string Id { get; set; } public string Name { get; set; }}
using (var session = documentStore.OpenAsyncSession()){ var user = new User { Id = "users/1", Tags = new List<Tag> { new Tag { Id = "tag-id1", Name = "Tag name" } } };
await session.StoreAsync(user, "users/1"); await session.SaveChangesAsync();}
using (var session = documentStore.OpenAsyncSession()){ var query = session.Query<User>();
var projection = from user in query let tagIds = user.Tags.Select(x => x.Id) let tags = user.Tags.Select(x => x.Name) select new { UserId = user.Id, Tags = tags, TagIds = tagIds };
var result = await projection.FirstAsync();}
{
UserId: "users/1",
Tags: ["Tag name"],
TagIds: ["tag-id1"]
}
{
UserId: "users/1",
Tags: ["Tag name"],
TagIds: [null]
}
Property not called Id:
{declare function output(user) { var tagIds = user.Tags.map(function(x){return x.NotJustId;}); var tags = user.Tags.map(function(x){return x.Name;}); return { UserId : id(user), Tags : tags, TagIds : tagIds };}from Users as user select output(user)}
{declare function output(user) { var tagIds = user.Tags.map(function(x){return id(x);}); var tags = user.Tags.map(function(x){return x.Name;}); return { UserId : id(user), Tags : tags, TagIds : tagIds };}from Users as user select output(user)}
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
--
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.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.