﻿<?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 RavenDB: Splitting entities across several documents</title><description>Configurator,
  
Yes, it would be a look as long as the index update trigger would touch the same document.
  
We aren't comparing the old/new data when updating a document, and the etag is always updated.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment18</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment18</guid><pubDate>Sun, 03 Oct 2010 12:37:25 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Splitting entities across several documents</title><description>Dennis,
  
Actually, no.
  
You would simple make two queries.
  
a) get recent posts
  
b) get votes where post id is in (...) from the votes index
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment17</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment17</guid><pubDate>Sun, 03 Oct 2010 12:35:58 GMT</pubDate></item><item><title>configurator commented on RavenDB: Splitting entities across several documents</title><description>@Ayenda: Would it be a loop even if the index result doesn't change? Suppose I define the index B = 2 * A and put a document
  
{ A = 1 }
  
It would be changed at some point to be
  
{ A = 1, B = 2 }
  
And then when the index is rerun it would be changed to
  
{ A = 1, B = 2 }
  
as this is no change, the index doesn't have to be run again. Or does it?
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment16</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment16</guid><pubDate>Fri, 01 Oct 2010 13:55:36 GMT</pubDate></item><item><title>Dennis commented on RavenDB: Splitting entities across several documents</title><description>Ayende, Wouldnt that easily be a N+1 query?
  
"Show a list of posts, and then for every post I need to add a javascript tag to see if I already votes on it, so I can get instant feedback in the gui."
  
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment15</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment15</guid><pubDate>Fri, 01 Oct 2010 13:38:26 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Splitting entities across several documents</title><description>Dennis,
  
I would have an additional index, that would output who voted, and I could query that index.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment14</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment14</guid><pubDate>Fri, 01 Oct 2010 11:25:54 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Splitting entities across several documents</title><description>Torkel,
  
No, it uses a separate document (//document id: questions/123/votes)
  
Both documents have a Votes array
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment13</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment13</guid><pubDate>Fri, 01 Oct 2010 11:25:24 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Splitting entities across several documents</title><description>Configurator,
  
You can absolutely do that using an index update trigger!
  
You just have to watch out not to modify the same document that the index is based on (other wise you create a loop).
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment12</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment12</guid><pubDate>Fri, 01 Oct 2010 11:24:36 GMT</pubDate></item><item><title>Ayende Rahien commented on RavenDB: Splitting entities across several documents</title><description>Benny,
  
No, it uses the votes document, not the unsplitted.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment11</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment11</guid><pubDate>Fri, 01 Oct 2010 11:23:45 GMT</pubDate></item><item><title>Demis Bellot commented on RavenDB: Splitting entities across several documents</title><description>@gandjustas
  
  
&gt;&gt;SADD is unsuitable here. You need to store Who voted.
  
  
My recommendation was storing 'user ids', i.e. who's voted. 
  
Using a set also ensures you only count each users vote once.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment10</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment10</guid><pubDate>Thu, 30 Sep 2010 07:28:17 GMT</pubDate></item><item><title>gandjustas commented on RavenDB: Splitting entities across several documents</title><description>SADD is unsuitable here. You need to store Who voted.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment9</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment9</guid><pubDate>Thu, 30 Sep 2010 06:34:38 GMT</pubDate></item><item><title>Demis Bellot commented on RavenDB: Splitting entities across several documents</title><description>This actually looks quite inefficient. If I needed to implement this in Redis I would store the user ids in 2 server-side sets, one for 'up' and the other for 'down' votes. 
  
  
Recording a vote can easily be done in a single 'SADD' set operation without needing to serialize/deserialize the entire document. By comparison this looks like it would be magnitudes of times slower.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment8</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment8</guid><pubDate>Wed, 29 Sep 2010 23:56:25 GMT</pubDate></item><item><title>Guy commented on RavenDB: Splitting entities across several documents</title><description>How is that better / worse than storing the votes in the Question document and having an index which projects a question with only the total votes?
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment7</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment7</guid><pubDate>Wed, 29 Sep 2010 18:01:44 GMT</pubDate></item><item><title>fschwiet commented on RavenDB: Splitting entities across several documents</title><description>I am surprised you put all the votes in one document still.  In the same situation, I had stored each vote as a document then used a map/reduce index to count the totals.   
  
  
How would you check if someone already voted?  I suppose you can create an index to split out the individual votes, so they can be read one at a time.  As people vote, you're going to have concurrency issues that you wouldn't have if the votes are individual documents.
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment6</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment6</guid><pubDate>Wed, 29 Sep 2010 16:29:32 GMT</pubDate></item><item><title>Dennis commented on RavenDB: Splitting entities across several documents</title><description>How will you deal with the "did I vote" on this without fetching the whole thing in?
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment5</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment5</guid><pubDate>Wed, 29 Sep 2010 12:41:26 GMT</pubDate></item><item><title>Torkel commented on RavenDB: Splitting entities across several documents</title><description>Yes, I am also a little puzzled. 
  
  
The index definition seems to use the original document where the Votes were part of the Question document. Was that the intent? Then why show the split?
  
  
/confused
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment4</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment4</guid><pubDate>Wed, 29 Sep 2010 12:28:15 GMT</pubDate></item><item><title>configurator commented on RavenDB: Splitting entities across several documents</title><description>A feature I'd like to see is the indexes updating entities, i.e.
  
{ //document id: questions/123
  
   Title: "How to handle Up/Down votes with Raven?",
  
   Content: "...",
  
}
  
  
{ //document id: questions/123/votes
  
   Votes: [
  
         { Up: true, User: "users/ayende" },
  
         { Up: false, User: "users/oren" },
  
  ]
  
}
  
Would be transformed automatically to
  
{ //document id: questions/123
  
   Title: "How to handle Up/Down votes with Raven?",
  
   Content: "...",
  
   UpVotes: 1,
  
   DownVotes: 1
  
}
  
  
{ //document id: questions/123/votes
  
   Votes: [
  
         { Up: true, User: "users/ayende" },
  
         { Up: false, User: "users/oren" },
  
  ]
  
}
  
  
And the UpVotes/DownVotes would be updated whenever the index is. Do you have such a feature?
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment3</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment3</guid><pubDate>Wed, 29 Sep 2010 11:33:23 GMT</pubDate></item><item><title>Benny Thomas commented on RavenDB: Splitting entities across several documents</title><description>Is it just me, or does your index use the unsplited document in this sample?
  
  
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment2</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment2</guid><pubDate>Wed, 29 Sep 2010 10:43:13 GMT</pubDate></item><item><title>gandjustas commented on RavenDB: Splitting entities across several documents</title><description>It looks like relational tables and join in view\function\storedproc, isn't it? ;)
</description><link>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment1</link><guid>http://ayende.com/4644/ravendb-splitting-entities-across-several-documents#comment1</guid><pubDate>Wed, 29 Sep 2010 10:42:23 GMT</pubDate></item></channel></rss>