﻿<?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>borcam commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>We simplify things a little for this article: The stack keeps track of what is executing in our application. As we enter and exit methods items are added to or removed from the top.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment20</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment20</guid><pubDate>Fri, 24 Aug 2012 13:51:33 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Njy,
We already have a feature like that, it is called Indexed Properties
http://issues.hibernatingrhinos.com/issue/RavenDB-245 </description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment19</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment19</guid><pubDate>Mon, 30 Jul 2012 17:01:34 GMT</pubDate></item><item><title>njy commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>@Oren: a suggestion, maybe a stupid one: it would be possible to specify a field as a "computed one"? It would be cool to define a field as computed, specifying the computing algorithm (in JS, of course) and when RavenDB parses that, it will understand which other fields are involved, and keep track of the things automatically.

Think about it: it would be conceptually just like indexes. You don't update indexes values by hand, but instead you specify a map/reduce "logic" and the index values will be updated for you by RavenDB.

The same concept should be used for computed values (typically denormalized values): the dev defines only one time the logic, and RavenDB would do the rest, in the background, when it feels like it should do it. And just like indexes can be stale, computed values could be, too.

There could be 2 ways of doing it, i think, and they would have different consequences:

1) per-field-compute-fiunction: the dev could define the body of a JS function, the return value of which would set the specified field value, like for example "return this.Comments.length" to define the logic for the "CommensCount" field. This function should be run only when one of the fields in the specified formula is updated;

2) per-entity: (like a server-side js entity-update trigger)it could do more stuff, like "this.CommentsCount = this.Comments.length; this.Foo = "Bar" + this.Baz;" or something like that;

What do you think?</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment18</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment18</guid><pubDate>Mon, 30 Jul 2012 09:26:42 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Daniel,
This is transactional, like all other things in RavenDB.
</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment17</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment17</guid><pubDate>Sun, 29 Jul 2012 13:31:28 GMT</pubDate></item><item><title>Daniel Lang commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>We can't have any transactional guarantees, right? So is there a way to detect a failure during the updates?</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment16</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment16</guid><pubDate>Sun, 29 Jul 2012 13:28:57 GMT</pubDate></item><item><title>aaron commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Perhaps it would be nice to have a small util included which allows you to execute a .cs script from the command line against a raven instance, something like DynamicScriptExecutor.exe Jul27Patch.cs --instance:http://localhost:8090/. which feeds back a success response or any exception info. </description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment15</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment15</guid><pubDate>Fri, 27 Jul 2012 01:03:05 GMT</pubDate></item><item><title>Rafal commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>This function looks powerful but ugly and hackishly at the some time - like something unfinished, part of much bigger functionality (a full-blown server side data processing language).  </description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment14</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment14</guid><pubDate>Thu, 26 Jul 2012 21:00:57 GMT</pubDate></item><item><title>Eric J. Smith commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>I can understand that.  It just sucks that the IronJS project seems to have died out.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment13</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment13</guid><pubDate>Thu, 26 Jul 2012 16:44:05 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Eric,
Put simply, because it is much easier to limit what you are doing in IronJS than in C#.
We already do dynamic compilation, and it is much easier to go this route than that.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment12</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment12</guid><pubDate>Thu, 26 Jul 2012 16:28:44 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Paul,
An exception is thrown, no update takes place.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment11</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment11</guid><pubDate>Thu, 26 Jul 2012 16:27:49 GMT</pubDate></item><item><title>Matt Warren commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>@Paul, 

Sorry that should've been AllowStale = false and it's actually the default, so it's already handled for you!!</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment10</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment10</guid><pubDate>Thu, 26 Jul 2012 16:10:06 GMT</pubDate></item><item><title>Matt Warren commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>@Paul, pass in AllowStale = true as the 4th argument to UpdateByIndex(..) and it'll handle this. Basically the patching won't go ahead if the index is stale at the time.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment9</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment9</guid><pubDate>Thu, 26 Jul 2012 16:08:39 GMT</pubDate></item><item><title>Eric J. Smith commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Why not use Mono's C# compiler services so that you could write these actions in C# instead of JavaScript?</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment8</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment8</guid><pubDate>Thu, 26 Jul 2012 14:59:46 GMT</pubDate></item><item><title>Paul Stovell commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>What happens if the index is stale at the time of the update? 

E.g., users/wilma just saved a new post, then changed her name, and the Posts/ByUser index hasn't been updated yet. </description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment7</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment7</guid><pubDate>Thu, 26 Jul 2012 13:17:37 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Khalid,
APR are commands to the database that modify the state. Their results are written to the db and then treated normally.
</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment6</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment6</guid><pubDate>Thu, 26 Jul 2012 12:54:01 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Tobi,
If you want it done on the client, that is easy, we have listener support for that.
</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment5</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment5</guid><pubDate>Thu, 26 Jul 2012 12:53:31 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>What does the document look like when you do an AdvancedPatchRequest, and are AdvancedPatchRequests replicated and part of backup?</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment4</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment4</guid><pubDate>Thu, 26 Jul 2012 12:47:31 GMT</pubDate></item><item><title>tobi commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>It would be a nice idea to have a trigger-like system for such cases. "No matter who changes the name, I want all denormalized data to be updates as well using the following command".

That could be configured at the client, too, if I'm not mistaken. The database does not need to be the driver for triggers.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment3</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment3</guid><pubDate>Thu, 26 Jul 2012 10:59:50 GMT</pubDate></item><item><title>Ayende Rahien commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Apostol,
Yes, that is the idea.
And no, there is no way to currently do that.</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment2</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment2</guid><pubDate>Thu, 26 Jul 2012 10:43:06 GMT</pubDate></item><item><title>Apostol commented on Awesome RavenDB Feature of the day: Eval Patching, Part II&amp;ndash;Denormalized References</title><description>Wow, so this means that if I have to make this kind of changes - reflect a change from one entity to another - I'm going to make a database command with this kind of script and send it to the server, and the server is going to make the update to all the entities without me needing to load them on client and send them back?

If that's right it's awesome - it's going to make RavenDb much more efficient. 

Another question - is there a way to specifying that we want to 'wait for non-stale results' before executing the Script/DatabaseCommand?</description><link>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment1</link><guid>http://ayende.com/157217/awesome-ravendb-feature-of-the-day-eval-patching-part-ii-denormalized-references#comment1</guid><pubDate>Thu, 26 Jul 2012 09:53:13 GMT</pubDate></item></channel></rss>