﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Andres commented on RavenDB: Includes</title><description>It is faster and simpler than triggers and than non-intuitive queries like this:
  
var order = session.Include("Customer.Id").Load
&lt;order("orders/1");
  
(magic string, and how you now that you are loading a Customer?)
  
  
But Raven index syntax is not enough expressive. Doesn't it?
  
  
Sorry about my bad English.
&gt;</description><link>http://ayende.com/4584/ravendb-includes#comment37</link><guid>http://ayende.com/4584/ravendb-includes#comment37</guid><pubDate>Thu, 16 Sep 2010 13:21:43 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Why would this be beneficial?
</description><link>http://ayende.com/4584/ravendb-includes#comment36</link><guid>http://ayende.com/4584/ravendb-includes#comment36</guid><pubDate>Thu, 16 Sep 2010 11:41:37 GMT</pubDate></item><item><title>Andres commented on RavenDB: Includes</title><description>That, maybe the includes and other denormalizations can be done by indexes.
  
</description><link>http://ayende.com/4584/ravendb-includes#comment35</link><guid>http://ayende.com/4584/ravendb-includes#comment35</guid><pubDate>Thu, 16 Sep 2010 11:32:35 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Andres,
  
While you can make this work, I am not quite sure what is the purpose. Especially in the context of includes.
</description><link>http://ayende.com/4584/ravendb-includes#comment34</link><guid>http://ayende.com/4584/ravendb-includes#comment34</guid><pubDate>Thu, 16 Sep 2010 10:58:22 GMT</pubDate></item><item><title>Andres commented on RavenDB: Includes</title><description>What about index based join? 
  
Like this:
  
  
Map: 
  
---------------------------------
  
from doc in docs 
  
where doc["@metadata"]["Raven-Entity-Name"] == "Products" || doc["@metadata"]["Raven-Entity-Name"] == "ProductInputs"
  
select new { 
  
    Code = doc["@metadata"]["Raven-Entity-Name"] == "Products" ? doc.Code : doc.ProductCode,
  
    Input = doc["@metadata"]["Raven-Entity-Name"] == "Products" ? doc.FirstInput : doc.Input
  
};
  
  
Reduce:
  
---------------------------------
  
from result in results
  
group result by result.Code into g
  
select new
  
{
  
    Code = g.Key,
  
    Count = g.Count(),
  
    TotalInputs = g.Sum(x =&gt; x.Input ?? 0)
  
}
</description><link>http://ayende.com/4584/ravendb-includes#comment33</link><guid>http://ayende.com/4584/ravendb-includes#comment33</guid><pubDate>Thu, 16 Sep 2010 03:30:41 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Daniel,
  
You can't say it is an implementation detail, not when the impact is making remote calls.
  
And you can't disallow lazy loading, not when I consider this lazy loading as well:
  
session.Load(order.Customer.Id);
  
  
Hypertext docs are great, but you only read ONE doc at a time. 
  
With DocDB documents, you may want to access more than that
</description><link>http://ayende.com/4584/ravendb-includes#comment32</link><guid>http://ayende.com/4584/ravendb-includes#comment32</guid><pubDate>Tue, 17 Aug 2010 06:01:05 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Daniel,
  
Yes, that is pretty much the point. Because you want to be able to control this for each scenario.
  
There is no one scenario that fit all
</description><link>http://ayende.com/4584/ravendb-includes#comment31</link><guid>http://ayende.com/4584/ravendb-includes#comment31</guid><pubDate>Tue, 17 Aug 2010 05:58:54 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Daniel,
  
And Customer has a reference to Company, which has reference to Products, which has reference to...
  
In other words, you loaded the entire database.
  
  
It isn't premature, it is something that you have to deal with
</description><link>http://ayende.com/4584/ravendb-includes#comment30</link><guid>http://ayende.com/4584/ravendb-includes#comment30</guid><pubDate>Tue, 17 Aug 2010 05:57:50 GMT</pubDate></item><item><title>Daniel Steigerwald commented on RavenDB: Includes</title><description>|This creates a misleading API, making people think that things are normalized when they aren’t.
  
It suppose it is implementation detail. Remember that object with id contained in another object with id is stored twice is easy.
  
  
|It is going to bring back ALL the problems associated with lazy loading (worse, it is going to bring back all the problems associated with EF 1.0 lazy loading).
  
So disallow lazy load at all. I don't need it anyway.
  
  
|It goes directly against the way I believe you should work with a document database.
  
What's wrong with hypertext documents? They are still documents. 
  
Include is nice feature, but soon enough my code probably will be full of includes.
  
  
PS: Maybe I overlooked something (or everything) ;) It was just written brainstorming :)
</description><link>http://ayende.com/4584/ravendb-includes#comment29</link><guid>http://ayende.com/4584/ravendb-includes#comment29</guid><pubDate>Tue, 17 Aug 2010 00:59:40 GMT</pubDate></item><item><title>Daniel Steigerwald commented on RavenDB: Includes</title><description>I hope I understand all consequences related to sql joins, especially lazy evaluated. I am still newbie, but as I see it, raven document database is about eagerness (as opposite to sql laziness). 
  
We have to create index before we can use it. Fine. We can put documents into db without scheme, super fine. So we should be able to load whole objects graphs in one step as well. 
  
  
This code:
  
  
var order = session
  
    .Include("Customer.Id")
  
    .Load
&lt;order("orders/1");
  
  
Is equivalent to afore mentioned, in case laziness is forbidden.
  
  
&gt;</description><link>http://ayende.com/4584/ravendb-includes#comment28</link><guid>http://ayende.com/4584/ravendb-includes#comment28</guid><pubDate>Tue, 17 Aug 2010 00:43:52 GMT</pubDate></item><item><title>Daniel Steigerwald commented on RavenDB: Includes</title><description>I am not sure, if denormalized references are not actually premature optimization. Why should user care about minified models? 
  
I know, it's stored twice, still... 
  
  
Aggregate is class with Id
  
  
public class Order
  
{
  
    public string Id { get; set; }
  
    public string Name { get; set; }
  
    public Customer Customer { get; set; }
  
}
  
  
public class Customer
  
{
  
    public string Id { get; set; }
  
    public string Name { get; set; }
  
    public string Email { get; set; }
  
  
}
  
  
What's wrong with loading Order with whole Customer? I suppose it's explicit enough. It should work also for storing.
  
Instead of Hibernate default laziness, Raven can eager load everything.
  
  
Maybe it is stupid idea, but I would like to hear your opinion.
  
  
</description><link>http://ayende.com/4584/ravendb-includes#comment27</link><guid>http://ayende.com/4584/ravendb-includes#comment27</guid><pubDate>Tue, 17 Aug 2010 00:19:53 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>oharab,
  
That would make the default case (no includes) much uglier.
  
</description><link>http://ayende.com/4584/ravendb-includes#comment26</link><guid>http://ayende.com/4584/ravendb-includes#comment26</guid><pubDate>Fri, 13 Aug 2010 14:35:55 GMT</pubDate></item><item><title>oharab commented on RavenDB: Includes</title><description>If you changed the API slightly could you have the order like cowgaR suggests.
  
  
var person=session.Get(Person).Load();
  
var person=session.Get(Person).Include("Customer").Load();
  
  
</description><link>http://ayende.com/4584/ravendb-includes#comment25</link><guid>http://ayende.com/4584/ravendb-includes#comment25</guid><pubDate>Fri, 13 Aug 2010 13:34:48 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>cowgaR,
  
Regarding the method ordering.
  
Sure, I would like that.
  
Now make it work when you don't include stuff as weel.
  
  
var person = session.Load(Person)
  
var person = session.Load(Person).Include("Customer")
  
  
Regarding the out param, good idea
</description><link>http://ayende.com/4584/ravendb-includes#comment24</link><guid>http://ayende.com/4584/ravendb-includes#comment24</guid><pubDate>Fri, 13 Aug 2010 09:36:29 GMT</pubDate></item><item><title>cowgaR commented on RavenDB: Includes</title><description>first thing, changing the order of chaining methods would bring IMO 
__much
 better meaning of what you were trying to accomplish.
  
  
var order = session.Load
&lt;order("orders/1").Include("Customer.Id");
  
  
  
second, if all you're after is having to hit the DB just once when retrieving the Customer document for known Order.Id, why don't make API to have the Customer document loaded in one straight call?
  
  
var customer;
  
var order = session.Include("Customer.Id"
__, out customer
&gt;).Load
&lt;order("orders/1");
  
  
for third, I would again change the ordering of methods so...
  
  
var customer;
  
var order = session.Load
&lt;order("orders/1").Include("Customer.Id", out customer);
  
  
  
just an idea, I know you're prove me wrong :)
&gt;</description><link>http://ayende.com/4584/ravendb-includes#comment23</link><guid>http://ayende.com/4584/ravendb-includes#comment23</guid><pubDate>Fri, 13 Aug 2010 08:33:01 GMT</pubDate></item><item><title>jdn commented on RavenDB: Includes</title><description>Thanks for accepting override patches.
</description><link>http://ayende.com/4584/ravendb-includes#comment22</link><guid>http://ayende.com/4584/ravendb-includes#comment22</guid><pubDate>Fri, 13 Aug 2010 00:41:28 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Jonty,
  
That might be the case, yes, and it might also be the case that it is a problem with the way we model stuff.
  
But that is a features that a lot of people wanted
</description><link>http://ayende.com/4584/ravendb-includes#comment21</link><guid>http://ayende.com/4584/ravendb-includes#comment21</guid><pubDate>Thu, 12 Aug 2010 18:32:41 GMT</pubDate></item><item><title>Jonty commented on RavenDB: Includes</title><description>"A common case would be if you need to notify the customer about delay in the order"
  
  
That sounds like a search screen where the rows would have the email in them already - ie a different document.
</description><link>http://ayende.com/4584/ravendb-includes#comment20</link><guid>http://ayende.com/4584/ravendb-includes#comment20</guid><pubDate>Thu, 12 Aug 2010 16:19:42 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Charles,
  
I wouldn't support it, I can't think of an  actual scenario where you need it in a document database.
</description><link>http://ayende.com/4584/ravendb-includes#comment19</link><guid>http://ayende.com/4584/ravendb-includes#comment19</guid><pubDate>Thu, 12 Aug 2010 15:10:09 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Benjamin,
  
Exactly the same.
  
  
Include("Orders")
</description><link>http://ayende.com/4584/ravendb-includes#comment18</link><guid>http://ayende.com/4584/ravendb-includes#comment18</guid><pubDate>Thu, 12 Aug 2010 15:09:12 GMT</pubDate></item><item><title>Benjamin commented on RavenDB: Includes</title><description>Hi Ayende,
  
  
Good stuff! With reference to Brian Vallelunga's question, how does a query (to preload all orders) look?
  
  
Thanks!
</description><link>http://ayende.com/4584/ravendb-includes#comment17</link><guid>http://ayende.com/4584/ravendb-includes#comment17</guid><pubDate>Thu, 12 Aug 2010 15:07:54 GMT</pubDate></item><item><title>Charles Strahan commented on RavenDB: Includes</title><description>Very neat, Ayende.  How would you support "including" a chain of references - such as Order.Customer.BestFriend.Etc?
  
  
-Charles
</description><link>http://ayende.com/4584/ravendb-includes#comment16</link><guid>http://ayende.com/4584/ravendb-includes#comment16</guid><pubDate>Thu, 12 Aug 2010 14:57:32 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Brian,
  
This scenario just works
</description><link>http://ayende.com/4584/ravendb-includes#comment15</link><guid>http://ayende.com/4584/ravendb-includes#comment15</guid><pubDate>Thu, 12 Aug 2010 14:23:44 GMT</pubDate></item><item><title>Brian Vallelunga commented on RavenDB: Includes</title><description>Any chance we'll be able to include a collection of Ids? I think it might be useful in situations like this:
  
  
  
public class Customer {
  
  
    public string Id { get; set; }
  
    public string[] OrderIds { get; set; }
  
  
}
  
  
I'd want to be able to preload all orders here.
</description><link>http://ayende.com/4584/ravendb-includes#comment14</link><guid>http://ayende.com/4584/ravendb-includes#comment14</guid><pubDate>Thu, 12 Aug 2010 13:59:57 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Tucaz,
  
In short, no. See the discussion on the model changes required to make this work, and why I don't like them.
  
The easy way to handle this is to use an ambient session, which is the general recommendation anyway.
  
  
And I _like_ the fact that you need to take an extra step. You don't want to be able to reference stuff outside your own aggregate easily. See the discussion on Root Aggregates in DDD
</description><link>http://ayende.com/4584/ravendb-includes#comment13</link><guid>http://ayende.com/4584/ravendb-includes#comment13</guid><pubDate>Thu, 12 Aug 2010 11:59:53 GMT</pubDate></item><item><title>tucaz commented on RavenDB: Includes</title><description>I´m not a NoSql user yet, but I have a question. If the type of Customer object in Order class is a DenormalizedReference is is possible for one to expect getting the full customer when calling for order.Customer somehow?
  
  
I understood that you can pre-fetch the Customer and then access it through Session.Load but then we would need to 1) Keep a reference to the session object in Order instance to encapsulate the GetCustomer() method to return the full Customer or 2) Let the caller know that order.Customer will never be entire filled and if he wants it he will need to call Session.Load(order.Customer.Id).
  
  
I´m think of a way to both communicate the user that he has everything available when he needs and still don´t leak infrastructure aspects to the domain.
  
</description><link>http://ayende.com/4584/ravendb-includes#comment12</link><guid>http://ayende.com/4584/ravendb-includes#comment12</guid><pubDate>Thu, 12 Aug 2010 11:54:30 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Jonty,
  
A common case would be if you need to notify the customer about delay in the order
</description><link>http://ayende.com/4584/ravendb-includes#comment11</link><guid>http://ayende.com/4584/ravendb-includes#comment11</guid><pubDate>Thu, 12 Aug 2010 11:48:05 GMT</pubDate></item><item><title>Jonty commented on RavenDB: Includes</title><description>What is an example of a case where you would need the email from the orders? Wouldn't you create a new document for that purpose? This seems like it might be encouraging bad design decisions.
</description><link>http://ayende.com/4584/ravendb-includes#comment10</link><guid>http://ayende.com/4584/ravendb-includes#comment10</guid><pubDate>Thu, 12 Aug 2010 11:23:37 GMT</pubDate></item><item><title>Adam commented on RavenDB: Includes</title><description>Great feature, love it, thanks
</description><link>http://ayende.com/4584/ravendb-includes#comment9</link><guid>http://ayende.com/4584/ravendb-includes#comment9</guid><pubDate>Thu, 12 Aug 2010 09:36:57 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Includes</title><description>Adam,
  
Yes
</description><link>http://ayende.com/4584/ravendb-includes#comment8</link><guid>http://ayende.com/4584/ravendb-includes#comment8</guid><pubDate>Thu, 12 Aug 2010 09:33:02 GMT</pubDate></item></channel></rss>