﻿<?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>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Martin,
  
Changing username is a rare occasion, you can handle that as a background process
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment20</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment20</guid><pubDate>Tue, 20 Jul 2010 11:18:55 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Martin,
  
Yes, you can.
  
You create an index that project those out, and then query on that
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment19</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment19</guid><pubDate>Tue, 20 Jul 2010 11:18:02 GMT</pubDate></item><item><title>Martin commented on Modeling hierarchical structures in RavenDB</title><description>... and what happens if a Username is stored for every Answer as it always needs to be displayed, but the user is allowed to change his Username ? 
  
  
Will i have to loop through all documents in the database where the Username is stored (almost everywhere there is a user action), and update the Username? will it be a problem ?
  
  
Thanks for a great blog.
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment18</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment18</guid><pubDate>Wed, 14 Jul 2010 22:55:36 GMT</pubDate></item><item><title>Martin commented on Modeling hierarchical structures in RavenDB</title><description>Is there a way to only load a small part of the Answers for paging (etc if there will be hundreds or thousands of them) soo the database wont have to send all of them ?
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment17</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment17</guid><pubDate>Wed, 14 Jul 2010 22:48:49 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Sebastian,
  
It shouldn't be very expensive.
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment16</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment16</guid><pubDate>Mon, 28 Jun 2010 13:07:15 GMT</pubDate></item><item><title>sebastien commented on Modeling hierarchical structures in RavenDB</title><description>What would be the cost of updating name in partialy denormalized reference ?
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment15</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment15</guid><pubDate>Mon, 28 Jun 2010 11:46:01 GMT</pubDate></item><item><title>Daniel Cohen commented on Modeling hierarchical structures in RavenDB</title><description>@Matt  warren , I get this if you go with the bare reference approach and then in you POCO class you have a string ParentId { get;set;}
  
  
but in the denormalized way what kind of class you get in return ?? it's not an id field nor a full Person class
  
  
btw "c# model" was intended to be the title not the name, a funny mistake :)
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment14</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment14</guid><pubDate>Fri, 25 Jun 2010 13:50:46 GMT</pubDate></item><item><title>Matt Warren commented on Modeling hierarchical structures in RavenDB</title><description>Just to add: Load is a generic method that need to have the type specified as  "Person", but it got stripped out in my answer.
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment13</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment13</guid><pubDate>Thu, 24 Jun 2010 10:18:36 GMT</pubDate></item><item><title>Matt Warren commented on Modeling hierarchical structures in RavenDB</title><description>@c# model
  
  
You can use the id string and load the document based on that, i.e. 
  
var person = session.Load
&lt;person("people/59");
&gt;</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment12</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment12</guid><pubDate>Thu, 24 Jun 2010 10:16:44 GMT</pubDate></item><item><title>c# model  commented on Modeling hierarchical structures in RavenDB</title><description>maybe i'm missing something here but the Person denormalized example saves only id and name. When you query the model  how does children and parent convert back to a whole c# person (with own parent and children) ?
  
  
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment11</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment11</guid><pubDate>Thu, 24 Jun 2010 04:39:48 GMT</pubDate></item><item><title>DavidChan commented on Modeling hierarchical structures in RavenDB</title><description>seems like client api doesnot support the command "patch" ,right?
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment10</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment10</guid><pubDate>Thu, 24 Jun 2010 03:01:11 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Jason, 
  
Yes...
  
Although I would put it differently
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment9</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment9</guid><pubDate>Wed, 23 Jun 2010 15:21:37 GMT</pubDate></item><item><title>Brian Vallelunga commented on Modeling hierarchical structures in RavenDB</title><description>Ahh, thanks, I see now. I read that as only being available with replication. Reading the mailing list, it seems there is client support at the store level for this. I haven't seen any examples of it though. I'll go ahead and ask on the list.
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment8</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment8</guid><pubDate>Wed, 23 Jun 2010 15:19:45 GMT</pubDate></item><item><title>Jason Young commented on Modeling hierarchical structures in RavenDB</title><description>Interesting!
  
  
So... for a limitlessly recursive heirarchy (e.g. parent-child relationship), you want each element in its own document, but for depth-limited relationships (e.g. question-answer), you can put all the "children" in a collection in the "parent" document, and "children" need not have documents of their own, correct?  If so, that makes sense to me.
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment7</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment7</guid><pubDate>Wed, 23 Jun 2010 15:13:59 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Brian,
  
As I told Nathan, the answer for that is to use Raven's partial document update support, which would resolve the issue
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment6</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment6</guid><pubDate>Wed, 23 Jun 2010 14:33:10 GMT</pubDate></item><item><title>Brian Vallelunga commented on Modeling hierarchical structures in RavenDB</title><description>I have a similar question to Nathan's. Given the StackOverflow model you presented, if  two people answer the question at about the same time, won't you get conflicts storing the data to the db.
  
  
I can imagine the following scenario:
  
  
1) Person A answers question.
  
2) Get question document for Person A
  
3) Append answer A
  
4) Person B answers question.
  
5) Get question document for Person B
  
6) Save Person A's answer to DB.
  
7) Append answer B
  
8) Save Person B's answer to DB.
  
  
If we let the last-in win, Person A's answer is completely gone. I've actually avoided working a part of my application that requires this sort of modeling because I haven't figured out what to do yet.
  
  
Obviously storing the answers as entities themselves would help, but we'd almost always want to access the data as one document in this situation. Can you expand on a strategy here?
  
  
Thanks
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment5</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment5</guid><pubDate>Wed, 23 Jun 2010 14:30:34 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>[ravendb.net/documentation/docs-http-api-patch](http://ravendb.net/documentation/docs-http-api-patch)</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment4</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment4</guid><pubDate>Wed, 23 Jun 2010 14:02:36 GMT</pubDate></item><item><title>Nathan Stott commented on Modeling hierarchical structures in RavenDB</title><description>How do the partial updates work?  Does the app have to specify that it is doing a partial update or does Raven do this behind the scenes?  Got a link handy?
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment3</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment3</guid><pubDate>Wed, 23 Jun 2010 13:41:11 GMT</pubDate></item><item><title>Ayende Rahien commented on Modeling hierarchical structures in RavenDB</title><description>Nathan,
  
That is a good point. WRT replication, Raven would be in the same situation as CouchDB, but Raven also support the notion of partial updates, things like: "Add this answer to the Answers array"
  
Which means that two concurrent updates can both succeed.
  
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment2</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment2</guid><pubDate>Wed, 23 Jun 2010 13:38:00 GMT</pubDate></item><item><title>Nathan Stott commented on Modeling hierarchical structures in RavenDB</title><description>In CouchDB, you would not want to embed the answers to a question directly in the document because if two people answered the question at about the same time, or if you were using replication and they answered it between replication cycles, then you would get a 409 (conflict).  If you add the answers as documents of their own, two people adding at the same time will not cause conflicts.
  
  
Would this scenario not be a problem with RavenDB?  What about RavenDB makes the proper choice of strategy different?  
</description><link>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment1</link><guid>http://ayende.com/4546/modeling-hierarchical-structures-in-ravendb#comment1</guid><pubDate>Wed, 23 Jun 2010 13:19:21 GMT</pubDate></item></channel></rss>