﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>RavenDB - The best .NET Document Database</title>
    <link>/</link>
    <description>RavenDB - The best .NET Document Database</description>
    <copyright>Hibernating Rhinos (c) 2012</copyright>
    <ttl>60</ttl>
    <item>
      <title>Faceted Search</title>
      <description>&lt;p&gt;When displaying a large amount of data, often &lt;a href="http://ravendb.net/faq/total-results-in-paged-data-set"&gt;paging&lt;/a&gt; is used to make viewing the data manageable. However it's also useful to give some context of the entire data-set and a easy way to drill-down into particular categories. The common approach to doing this is "faceted search", as shown in the image below. &lt;strong&gt;Note&lt;/strong&gt; how the count of each category within the current search is across the top.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ravendb.net/Uploads/Windows-Live-Writer/f514cc74d920_DFC2/CNET_faceted_search_2.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="CNET_faceted_search" border="0" alt="CNET_faceted_search" src="http://ravendb.net/Uploads/Windows-Live-Writer/f514cc74d920_DFC2/CNET_faceted_search_thumb.jpg" width="683" height="344" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To achieve this in RavenDB, lets say you have a document like this:&lt;/p&gt;  &lt;p&gt;{    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; DateOfListing: &amp;quot;2000-09-01T00:00:00.0000000+01:00&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Manufacturer: &amp;quot;Jessops&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Model: &amp;quot;blah&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Cost: 717.502206059872     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Zoom: 9     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Megapixels: 10.4508949012733     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ImageStabiliser: false     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Step 1: &lt;/strong&gt;You need to setup your facet definitions and store them in RavenDB as a document, like so:&lt;/p&gt;  &lt;pre class="code"&gt;_facets = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Facet&lt;/span&gt;&amp;gt;
                        {
                            &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Facet &lt;/span&gt;{Name = &lt;span style="color: #a31515"&gt;&amp;quot;Manufacturer&amp;quot;&lt;/span&gt;},
                            &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Facet
                                &lt;/span&gt;{
                                    Name = &lt;span style="color: #a31515"&gt;&amp;quot;Cost_Range&amp;quot;&lt;/span&gt;,
                                    Mode = &lt;span style="color: #2b91af"&gt;FacetMode&lt;/span&gt;.Ranges,
                                    Ranges =
                                        {
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[NULL TO Dx200.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx200.0 TO Dx400.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx400.0 TO Dx600.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx600.0 TO Dx800.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx800.0 TO NULL]&amp;quot;&lt;/span&gt;,
                                        }
                                },
                            &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Facet
                                &lt;/span&gt;{
                                    Name = &lt;span style="color: #a31515"&gt;&amp;quot;Megapixels_Range&amp;quot;&lt;/span&gt;,
                                    Mode = &lt;span style="color: #2b91af"&gt;FacetMode&lt;/span&gt;.Ranges,
                                    Ranges =
                                        {
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[NULL TO Dx3.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx3.0 TO Dx7.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx7.0 TO Dx10.0]&amp;quot;&lt;/span&gt;,
                                            &lt;span style="color: #a31515"&gt;&amp;quot;[Dx10.0 TO NULL]&amp;quot;&lt;/span&gt;,
                                        }
                                }
                        };&lt;/pre&gt;

&lt;pre class="code"&gt;session.Store(&lt;span style="color: blue"&gt;new &lt;/span&gt;FacetSetup { Id = &lt;span style="color: #a31515"&gt;&amp;quot;facets/CameraFacets&amp;quot;&lt;/span&gt;, Facets = _facets });&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;font face="Verdana"&gt;This tells Raven that you would like to get the following facets&lt;/font&gt;&lt;/pre&gt;

&lt;ul&gt;
  &lt;li&gt;For the &lt;strong&gt;Manufacturer&lt;/strong&gt; field look at the documents and return a count for each unique Term found &lt;/li&gt;

  &lt;li&gt;For the &lt;strong&gt;Cost&lt;/strong&gt; field, return the count of the following ranges: 

    &lt;ul&gt;
      &lt;li&gt;Cost &amp;lt;= 200.0 &lt;/li&gt;

      &lt;li&gt;200.0 &amp;lt;= Cost &amp;lt;= 400.0 &lt;/li&gt;

      &lt;li&gt;400.0 &amp;lt;= Cost &amp;lt;= 600.0 &lt;/li&gt;

      &lt;li&gt;600.0 &amp;lt;= Cost &amp;lt;= 800.0 &lt;/li&gt;

      &lt;li&gt;Cost &amp;gt;= 800.0 &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: &lt;/strong&gt;Next you need to create an index to work against, this can be setup like so:&lt;/p&gt;

&lt;pre class="code"&gt;store.DatabaseCommands.PutIndex(&lt;span style="color: #a31515"&gt;&amp;quot;CameraCost&amp;quot;&lt;/span&gt;,
                            &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IndexDefinition
                            &lt;/span&gt;{
                                Map = &lt;span style="color: #a31515"&gt;@&amp;quot;from camera in docs 
                                    select new 
                                    { 
                                        camera.Manufacturer, 
                                        camera.Model, 
                                        camera.Cost,
                                        camera.DateOfListing,
                                        camera.Megapixels
                                    }&amp;quot;
                            &lt;/span&gt;});&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Step 3: &lt;/strong&gt;Finally you can write the following code and you get back the data below. &lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;var &lt;/span&gt;facetResults = s.Query&amp;lt;&lt;span style="color: #2b91af"&gt;Camera&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;&amp;quot;CameraCost&amp;quot;&lt;/span&gt;) 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .Where(x =&amp;gt; x.Cost &amp;gt;= 100 &amp;amp;&amp;amp; x.Cost &amp;lt;= 300 ) 

  &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ToFacets(&lt;span style="color: #a31515"&gt;&amp;quot;facets/CameraFacets&amp;quot;&lt;/span&gt;);&lt;/p&gt;

&lt;p&gt;This is equivalent to hitting the following Url:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://localhost:8080/facets/CameraCost?facetDoc=facets/CameraFacets&amp;amp;query=Cost_Range:[Dx100 TO Dx300.0]"&gt;http://localhost:8080/facets/CameraCost?facetDoc=facets/CameraFacets&amp;amp;query=Cost_Range:[Dx100 TO Dx300.0]&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;The data returned represents the count of the faceted data that satisfies the query&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Where(x =&amp;gt; x.Cost &amp;gt;= 100 &amp;amp;&amp;amp; x.Cost &amp;lt;= 300 ) 
    &lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="http://ravendb.net/Uploads/Windows-Live-Writer/f514cc74d920_DFC2/Facet%20Screenshot_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Facet Screenshot" border="0" alt="Facet Screenshot" src="http://ravendb.net/Uploads/Windows-Live-Writer/f514cc74d920_DFC2/Facet%20Screenshot_thumb.png" width="385" height="935" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>/documentation/faceted-search</link>
      <pubDate>Mon, 12 Sep 2011 16:43:09 GMT</pubDate>
    </item>
    <item>
      <title>Raven Backup &amp;amp; Restore</title>
      <description>&lt;div class="layoutregion"&gt;   &lt;div style="overflow: auto" dir="ltr" id="g_body"&gt;     &lt;div&gt;Like all databases, Raven supports backup and restore.&amp;#160; Backups can be performed while the database in online and accepting requests (including writes).&amp;#160; &lt;/div&gt;      &lt;div&gt;A Raven database can be backed up using:&lt;/div&gt;      &lt;div&gt;       &lt;ul&gt;         &lt;li&gt;Using your existing enterprise backup solution.            &lt;br /&gt;Raven supports VSS backups, which is how most backup solutions on Windows work. You can do that by configuring your backup solution to take backups of Raven's data directory.             &lt;br /&gt;&lt;/li&gt;          &lt;li&gt;Using Raven's own backup / restore system. You can ask Raven to perform a complete backup of its data to a specified directory at any time. During the backup procedure, the database remains online and can respond to read and write requests. However, it is the state of the database at the &lt;i&gt;start&lt;/i&gt;&amp;#160; of the backup. &lt;/li&gt;       &lt;/ul&gt;        &lt;div&gt;Unlike backups, restores are offline operation. You cannot restore to a running database (indeed, the notion makes little sense).&lt;/div&gt;        &lt;h3&gt;Backward&amp;#160; compatibility&lt;/h3&gt;     &lt;/div&gt;      &lt;div&gt;Raven relies on OS services to manage data storage and backup. Those services are forward compatible (if you backup on Windows XP you can restore on Windows 7) but &lt;i&gt;not&lt;/i&gt;&amp;#160; backward compatible (if you backup on Windows 2008 you &lt;i&gt;cannot &lt;/i&gt;restore on Windows 2003).&lt;/div&gt;      &lt;h3&gt;How to initiate a backup&lt;/h3&gt;      &lt;div&gt;When running in embedded mode, all you need is to call the &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;DocumentDatabase.StartBackup&lt;/font&gt;,&amp;#160; when running in server mode, a POST request to&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt; /admin/backup&lt;/font&gt; will initiate a backup, you must provide the backup location:&lt;/div&gt;      &lt;div&gt;       &lt;pre style="border-bottom: rgb(174,189,204) 1px solid; border-left: rgb(174,189,204) 1px solid; background-color: rgb(243,245,247); border-top: rgb(174,189,204) 1px solid; border-right: rgb(174,189,204) 1px solid"&gt;&amp;gt; curl -X POST http://localhost:8080/admin/backup -d &amp;quot;{ 'BackupLocation': 'C:\\Backups\\2010-05-06' }&amp;quot;&lt;/pre&gt;
    &lt;/div&gt;

    &lt;div&gt;Only administrators can initiate a backup using this approach.&lt;/div&gt;

    &lt;div&gt;Either method is&amp;#160; asynchronous, the backup process will start, and the request will complete before the backup process is completed. You can check the status of the backup by querying the document with the key: &amp;quot;Raven/Backup/Status&amp;quot;. The backup is completed when the IsRunning field in the document is set to false.&amp;#160; The backup current status can be tracked by querying the backup status document, this includes any errors that occur during the backup process.&lt;/div&gt;

    &lt;div&gt;Only one backup may run at any given time.&lt;/div&gt;

    &lt;div&gt;&amp;#160;&lt;/div&gt;

    &lt;div&gt;If running from IIS, make sure to enable Windows Authentication for RavenDB's IIS application.&lt;/div&gt;

    &lt;h2&gt;How to restore a database&lt;/h2&gt;

    &lt;div&gt;Restoring a database is an offline operation, it cannot operate on a running instance of Raven. In embedded mode, you can restore using &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;DocumentDatabase.Restore&lt;/font&gt;, or through the command line:&lt;/div&gt;

    &lt;div&gt;
      &lt;div&gt;
        &lt;pre style="border-bottom: rgb(174,189,204) 1px solid; border-left: rgb(174,189,204) 1px solid; background-color: rgb(243,245,247); border-top: rgb(174,189,204) 1px solid; border-right: rgb(174,189,204) 1px solid"&gt;&amp;gt; Raven.Server.exe -src [backup location] -dest [restore location] -restore&lt;/pre&gt;
      &lt;/div&gt;
    &lt;/div&gt;

    &lt;div&gt;If the restore location doesn't exists, Raven will create it.&lt;/div&gt;

    &lt;div&gt;You cannot restore to an existing database data directory, the restore operation will fail if it detects that the restore operation will overwrite existing data. If you need to restore to an existing database data directory, shutdown the database instance and delete the data directory.&lt;/div&gt;

    &lt;div&gt;Unlike backups, restores are fully&amp;#160; synchronous.&amp;#160; &lt;/div&gt;
    &lt;wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/div&gt;

  &lt;div class="clear"&gt;&lt;/div&gt;
&lt;/div&gt;</description>
      <link>/documentation/docs-backup-restore</link>
      <pubDate>Thu, 11 Aug 2011 12:01:53 GMT</pubDate>
    </item>
    <item>
      <title>Raven - Triggers</title>
      <description>&lt;p&gt;Raven allows you to use triggers to add custom behavior for the database. Those triggers are wired together using &lt;a href="http://mef.codeplex.com/"&gt;MEF&lt;/a&gt;, by default, Raven will search for triggers in a directory called Plugins under the application base directory.&lt;/p&gt;  &lt;p&gt;Raven supports the following triggers:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="/documentation/triggers/put"&gt;PUT triggers&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="/documentation/triggers/delete"&gt;DELETE triggers&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="/documentation/triggers/read"&gt;Read triggers&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="/documentation/triggers/index"&gt;Index update triggers&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;While not precisely a trigger, the document codec does fall into the same category:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenTriggers_B4A4/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenTriggers_B4A4/image_thumb_5.png" width="451" height="143" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This allows you to control the actual byte storage format on the disk. This is useful if you want to encrypt the data on the disk.&lt;/p&gt;</description>
      <link>/documentation/docs-server-triggers</link>
      <pubDate>Mon, 01 Aug 2011 04:37:29 GMT</pubDate>
    </item>
    <item>
      <title>Enabling debug logging for Raven</title>
      <description>&lt;div class="layoutregion"&gt;   &lt;div style="overflow: auto" id="g_body"&gt;     &lt;p&gt;Raven has extensive support for debug logging, enabling you to figure out exactly what is going on in the server. By default, logging is turned off but you can enable it at any time by creating a file called &amp;quot;NLog.config&amp;quot; in Raven's base directory with the following content:&lt;/p&gt;      &lt;blockquote&gt;       &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;nlog&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://www.nlog-project.org/schemas/NLog.netfx35.xsd&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;xmlns:xsi&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;targets&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt; 
            &lt;span class="attr"&gt;xsi:type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AsyncWrapper&amp;quot;&lt;/span&gt;
            &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AsyncLog&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt; &lt;span class="attr"&gt;xsi:type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;OutputDebugString&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;layout&lt;/span&gt; &lt;span class="attr"&gt;xsi:type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;SimpleLayout&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;        
            
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;target&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;targets&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;logger&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Raven.*&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;writeTo&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AsyncLog&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;nlog&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
      &lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;
    &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

    &lt;p&gt;You can then use a tool such as &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="nofollow"&gt;dbgview&lt;/a&gt; to view the logs.&lt;/p&gt;
    &lt;wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/div&gt;

  &lt;div class="clear"&gt;&lt;/div&gt;
&lt;/div&gt;</description>
      <link>/documentation/docs-debug-logging</link>
      <pubDate>Mon, 01 Aug 2011 04:36:22 GMT</pubDate>
    </item>
    <item>
      <title>Recommended Deployment</title>
      <description>&lt;p&gt;Minimum requirements for RavenDB to run in embedded mode:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;512 MB of RAM&lt;/li&gt;    &lt;li&gt;Pentium III-class, 700MHz&lt;/li&gt;    &lt;li&gt;150 MB of disk space&lt;/li&gt;    &lt;li&gt;32 bits OS&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Those are the &lt;em&gt;absolute minimum&lt;/em&gt; amounts required for it to run. Please note that this is strictly for embedded mode, usually for dedicated devices such as Point of Sales systems where the amount of data and the number of queries are known in advance and the system has been configured specifically to allow that.&lt;/p&gt;  &lt;p&gt;Minimum requirements for RavenDB to run in server mode:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;2 GB of RAM&lt;/li&gt;    &lt;li&gt;1 GHz Dual core &lt;/li&gt;    &lt;li&gt;1 GB of disk space&lt;/li&gt;    &lt;li&gt;64 bits OS&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Recommended configuration for RavenDB in server mode:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;4 GB of RAM (more is better)&lt;/li&gt;    &lt;li&gt;2 GHz Quad core (more is better)&lt;/li&gt;    &lt;li&gt;50 GB of disk space (more is better)&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Note that splitting the db across multiple physical HDs is also recommended&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;64 bits OS&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you have any questions regarding deployment, please contact us at support@hibernatingrhinos.com&lt;/p&gt;</description>
      <link>/faq/recommended-deployment</link>
      <pubDate>Tue, 26 Jul 2011 07:46:53 GMT</pubDate>
    </item>
    <item>
      <title>Support options</title>
      <description>&lt;p&gt;RavenDB has multiple avenues for support:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The RavenDB mailing list is available at: &lt;a href="http://groups.google.com/group/ravendb/"&gt;http://groups.google.com/group/ravendb/&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Commercial support (available for users who purchased RavenDB commercially) can be obtained by contacting &lt;a href="mailto:support@hibernatingrhinos.com"&gt;support@hibernatingrhinos.com&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;</description>
      <link>/support</link>
      <pubDate>Sun, 24 Jul 2011 06:51:39 GMT</pubDate>
    </item>
    <item>
      <title>Batching requests</title>
      <description>&lt;div&gt;RavenDB supports batching multiple operations into a single request, reducing the number of remote calls and allowing several operations to share the same transactions.&lt;/div&gt;  &lt;div&gt;Request batching in RavenDB is handled using the '/bulk_docs' endpoint, which accepts an array of operations to execute. The format for the operations is:&lt;/div&gt;  &lt;div&gt;   &lt;ul&gt;     &lt;li&gt;method - PUT, PATCH or DELETE. &lt;/li&gt;      &lt;li&gt;key - the document key that this operation pertains to. &lt;/li&gt;      &lt;li&gt;etag - optional - the etag to check against the current document etag. &lt;/li&gt;      &lt;li&gt;document - the JSON document to PUT. &lt;/li&gt;      &lt;li&gt;@metadata - the metadata associated with the document to PUT. &lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;  &lt;div&gt;Below you can see an example of the the operation format:&lt;/div&gt;  &lt;div&gt;   &lt;pre class="csharpcode"&gt;[
    {
        Method: &lt;span class="str"&gt;&amp;quot;PUT&amp;quot;&lt;/span&gt;,
        Document:
        {
            name: &lt;span class="str"&gt;&amp;quot;BatchPut1_Name&amp;quot;&lt;/span&gt;
        },
        Metadata:
        {
            info: &lt;span class="str"&gt;&amp;quot;BatchPut1_Info&amp;quot;&lt;/span&gt;
        },
        Key: &lt;span class="str"&gt;&amp;quot;BatchPut1&amp;quot;&lt;/span&gt;
    },
    {
        Method: &lt;span class="str"&gt;&amp;quot;PUT&amp;quot;&lt;/span&gt;,
        Document:
       {
           name: &lt;span class="str"&gt;&amp;quot;BatchPut2_Name&amp;quot;&lt;/span&gt;
       },
       Metadata:&lt;br /&gt;       {
           info: &lt;span class="str"&gt;&amp;quot;BatchPut2_Info&amp;quot;&lt;/span&gt;
       },
        Key: &lt;span class="str"&gt;&amp;quot;BatchPut2&amp;quot;&lt;/span&gt;
    },
    {
        Method: &lt;span class="str"&gt;&amp;quot;DELETE&amp;quot;&lt;/span&gt;,
        Key: &lt;span class="str"&gt;&amp;quot;BatchPut1&amp;quot;&lt;/span&gt;
    },
    {
        Method: &lt;span class="str"&gt;&amp;quot;DELETE&amp;quot;&lt;/span&gt;,
        Key: &lt;span class="str"&gt;&amp;quot;NonExistent&amp;quot;&lt;/span&gt;
    }
]&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/div&gt;

&lt;div&gt;This can be executed using curl with the following syntax:&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div&gt;
  &lt;pre style="border-bottom: rgb(174,189,204) 1px solid; border-left: rgb(174,189,204) 1px solid; background-color: rgb(243,245,247); border-top: rgb(174,189,204) 1px solid; border-right: rgb(174,189,204) 1px solid"&gt;&amp;gt; curl http://localhost:8080/bulk_docs -X POST -d &amp;quot;[ { Method:'PUT', Document:{  name:'BatchPut1_Name' }, Metadata:{  info:'BatchPut1_Info' },Key:'BatchPut1' }, 
                                                   { Method:'PUT', Document:{  name:'BatchPut2_Name' }, Metadata:{  }, Key:'BatchPut2' } ]&amp;quot;


&lt;span style="line-height: 14px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; white-space: nowrap; color: rgb(102,102,102); font-size: 12px"&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;[&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Etag&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;4c06db4e-4c86-11df-8ec2-001fd08ec235&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Method&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;PUT&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Key&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;BatchPut1&amp;quot;&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;}&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Etag&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;4c06db4f-4c86-11df-8ec2-001fd08ec235&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Method&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;PUT&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;,&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; font-weight: 700; padding-top: 0px"&gt;&amp;quot;Key&amp;quot;&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(51,51,51); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;:&lt;/span&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;&amp;quot;BatchPut2&amp;quot;&lt;/span&gt;&lt;br /&gt; &lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(102,102,102); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="padding-bottom: 0px; border-right-width: 0px; background-color: transparent; margin: 0px; padding-left: 0px; outline-width: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; color: rgb(136,136,136); font-size: 12px; vertical-align: baseline; border-left-width: 0px; padding-top: 0px"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3&gt;Concurrency&lt;/h3&gt;

&lt;div&gt;If an etag is specified in the command, that etag is compared to the current etag on the document on the server. If the etags do no match, a 409 Conlict status code is returned. In such a case, the entire operation fails and non of the updates that were tried will succeed.&lt;/div&gt;

&lt;h3&gt;Transactions&lt;/h3&gt;

&lt;div&gt;All the operations in the batch will succeed or fail as a transaction. Other users will not be able to see any of the changes until the entire batch completes.&lt;/div&gt;
&lt;wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;</description>
      <link>/documentation/docs-http-batching-2</link>
      <pubDate>Wed, 01 Jun 2011 11:18:10 GMT</pubDate>
    </item>
    <item>
      <title>Using projections</title>
      <description>&lt;p&gt;Usually, RavenDB can tell what types you want to return based on the query type and the CLR type encoded in a document, but there are some cases where you want to query on one thing, but the result is completely different. This is usually the case when you are using live projections. &lt;/p&gt;  &lt;p&gt;For example, let us take a look at the following index:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;public class PurchaseHistoryIndex : AbstractIndexCreationTask&amp;lt;Order, Order&amp;gt;     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; public PurchaseHistoryIndex()      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Map = orders =&amp;gt; from order in orders      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from product in order.Items      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; select new      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; UserId = order.UserId,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ProductId = product.Id      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TransformResults = (database, orders) =&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from order in orders      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from item in order.Items      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; let product = database.Load&amp;lt;Product&amp;gt;(item.Id)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; where product != null      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; select new      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ProductId = item.Id,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ProductName = product.Name      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;    &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;}      &lt;br /&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Note that when we query this index, we can query based on UserId or ProductId, but the result that we get back aren't of the same type that we query on. For that reason, we have the As&amp;lt;T&amp;gt;() extension method. We can use it to change the result type of the query:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;documentSession.Query&amp;lt;Shipment, PurchaseHistoryIndex&amp;gt;()
   .Where(x =&amp;gt; x.UserId == userId)
   .As&amp;lt;PurchaseHistoryViewItem&amp;gt;()
   .ToArray(),&lt;/pre&gt;
  &lt;style type="text/css"&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;In the code above, we query the PurchaseHistoryIndex using Shipment as the entity type to search on, but we get the results as PurchaseHistoryViewItem.&lt;/p&gt;</description>
      <link>/faq/projections</link>
      <pubDate>Thu, 12 May 2011 19:03:39 GMT</pubDate>
    </item>
    <item>
      <title>Raven DB &amp;ndash; Hello World</title>
      <description>&lt;p&gt;This will guide you throughout building your first Raven DB application.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;We start by heading to &lt;a href="http://ravendb.net/download"&gt;download page&lt;/a&gt; and getting the &lt;a href="http://builds.hibernatingrhinos.com/downloadlatest/ravendb"&gt;latest build&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Unzip the downloaded file. &lt;/li&gt;    &lt;li&gt;Go to the /Server directory and double click on the Raven.Server.exe      &lt;ul&gt;       &lt;li&gt;This will start the RavenDB server listening on localhost:8080 &lt;/li&gt;        &lt;li&gt;If you already have an application listening on 8080, you can change the port RavenDB will listen to by editing the &amp;quot;Raven/Port&amp;quot; appSetting value in the Raven.Server.exe.config file. &lt;/li&gt;        &lt;li&gt;RavenDB will automatically create a database in the /Data directory &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_10B9B/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_10B9B/image_thumb_1.png" width="524" height="338" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In Visual Studio, create a new console application project named: Raven.HelloWorld &lt;/li&gt;    &lt;li&gt;Add a reference to the Raven.Client.Lightweight.dll from the /Client directory      &lt;ul&gt;       &lt;li&gt;If you are using Visual Studio 2008, add a reference to Raven.Client-3.5.dll from /Client-3.5 directory &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_thumb_2.png" width="323" height="201" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Initialize the client:      &lt;ul&gt;       &lt;li&gt;DocumentStore should be created once per application and stored as a singleton. &lt;/li&gt;     &lt;/ul&gt;      &lt;pre class="csharpcode"&gt;var store = &lt;span class="kwrd"&gt;new&lt;/span&gt; DocumentStore {Url = &lt;span class="str"&gt;&amp;quot;http://localhost:8080&amp;quot;&lt;/span&gt;};&lt;br /&gt;store.Initialize();&lt;/pre&gt;
    &lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/li&gt;

  &lt;li&gt;We define an entity model that we can work with: 
    &lt;ul&gt;
      &lt;li&gt;Note that all the entities are POCO &lt;/li&gt;

      &lt;li&gt;The only requirement is that a root entity string Id property (configurable) &lt;/li&gt;
    &lt;/ul&gt;

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Product
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;decimal&lt;/span&gt; Cost { get; set; }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Order
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Customer { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; IList&amp;lt;OrderLine&amp;gt; OrderLines { get; set; }

    &lt;span class="kwrd"&gt;public&lt;/span&gt; Order()
    {
        OrderLines = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;OrderLine&amp;gt;();
    }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; OrderLine
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ProductId { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Quantity { get; set; }
}&lt;/pre&gt;
  &lt;/li&gt;

  &lt;li&gt;Let us save some data: 
    &lt;ul&gt;
      &lt;li&gt;The client API works using the session / data context model. &lt;/li&gt;

      &lt;li&gt;The client API implements the Unit of Work pattern. &lt;/li&gt;

      &lt;li&gt;Entity ids are only set when the SaveChanges method is called. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (var session = store.OpenSession())
{
    var product = &lt;span class="kwrd"&gt;new&lt;/span&gt; Product
    {
        Cost = 3.99m,
        Name = &lt;span class="str"&gt;&amp;quot;Milk&amp;quot;&lt;/span&gt;,
    };
    session.Store(product);
    session.SaveChanges();

    session.Store(&lt;span class="kwrd"&gt;new&lt;/span&gt; Order
    {
        Customer = &lt;span class="str"&gt;&amp;quot;customers/ayende&amp;quot;&lt;/span&gt;,
        OrderLines =
                      {
                          &lt;span class="kwrd"&gt;new&lt;/span&gt; OrderLine
                          {
                              ProductId = product.Id,
                              Quantity = 3
                          },
                      }
    });
    session.SaveChanges();
}&lt;/pre&gt;
    &lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/li&gt;

  &lt;li&gt;Execute the code. 
    &lt;ul&gt;
      &lt;li&gt;By default, RavenDB only allow authenticate users to modify documents and attachments. &lt;/li&gt;

      &lt;li&gt;The client API attempts to authenticate using the current user credentials. &lt;/li&gt;

      &lt;li&gt;You can set the credentials that the client API will use globally (set the DocumentStore.Credentials method) or per session (use the OpenSession(ICredentials) overload). &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;Go to &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt; in your browser. &lt;/li&gt;

  &lt;li&gt;Click on the &amp;quot;documents&amp;quot; tab, it should look something like this: &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_thumb_4.png" width="683" height="239" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The first two documents are the ones that we created, the third is part of the default documents that Ravens come with, including Raven's own documentation.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Looking more closely at those documents, you can see that we have two documents: 
    &lt;ul&gt;
      &lt;li&gt;Note that order lines are embedded inside the orders document. You can read more on this &lt;a href="http://ravendb.net/documentation/docs-document-design"&gt;design decision&lt;/a&gt;. &lt;/li&gt;

      &lt;li&gt;Note the document keys: &amp;quot;products/1&amp;quot;, &amp;quot;orders/1&amp;quot;. Those are generated by Raven, the intend is to make them RESTful and human readable. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_thumb_6.png" width="749" height="202" /&gt;&lt;/a&gt;&amp;#160;&amp;#160; &lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;And now let us get those documents back: 
    &lt;br /&gt;

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (var session = store.OpenSession())
{
    var order = session.Load&amp;lt;Order&amp;gt;(&lt;span class="str"&gt;&amp;quot;orders/1&amp;quot;&lt;/span&gt;);
    Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Customer: {0}&amp;quot;&lt;/span&gt;, order.Customer);
    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var orderLine &lt;span class="kwrd"&gt;in&lt;/span&gt; order.OrderLines)
    {
        Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Product: {0} x {1}&amp;quot;&lt;/span&gt;, orderLine.ProductId, orderLine.Quantity);
    }
    session.SaveChanges();
}&lt;/pre&gt;
    &lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/li&gt;

  &lt;li&gt;Execute the code, which gives us: 
    &lt;ul&gt;
      &lt;li&gt;If you'll look in Fiddler, you'll note that only one request was made, to get the entire object model. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  &lt;br /&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_thumb_7.png" width="356" height="109" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Now, for querying, we need to query all order that contains a particular product. 
    &lt;ul&gt;
      &lt;li&gt;Raven requires you to define an index before you can query it. &lt;/li&gt;

      &lt;li&gt;Think about an index as a stored procedure. &lt;/li&gt;

      &lt;li&gt;You should only create an index once. &lt;/li&gt;
    &lt;/ul&gt;

    &lt;pre class="csharpcode"&gt;store.DatabaseCommands.PutIndex(&lt;span class="str"&gt;&amp;quot;OrdersContainingProduct&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; IndexDefinitionBuilder&amp;lt;Order&amp;gt;
{
    Map = orders =&amp;gt; from order &lt;span class="kwrd"&gt;in&lt;/span&gt; orders
                    from line &lt;span class="kwrd"&gt;in&lt;/span&gt; order.OrderLines
                    select &lt;span class="kwrd"&gt;new&lt;/span&gt; { line.ProductId }
});&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;li&gt;With the index in existence, we can now query it: 
    &lt;ul&gt;
      &lt;li&gt;The query syntax in Raven is based on the &lt;a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html"&gt;Lucene syntax&lt;/a&gt;. &lt;/li&gt;

      &lt;li&gt;We call WaitForNonStaleResults because we just updated the database and Raven updates indexes on the background. 
        &lt;ul&gt;
          &lt;li&gt;&lt;em&gt;Normally you shouldn't call this method!&lt;/em&gt; &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;

    &lt;pre class="csharpcode"&gt; &lt;span class="kwrd"&gt;using&lt;/span&gt; (var session = store.OpenSession())
 {
     var orders = session.Advanced.LuceneQuery&amp;lt;Order&amp;gt;(&lt;span class="str"&gt;&amp;quot;OrdersContainingProduct&amp;quot;&lt;/span&gt;)
         .Where(&lt;span class="str"&gt;&amp;quot;ProductId:products/1&amp;quot;&lt;/span&gt;)
         .WaitForNonStaleResults()
         .ToArray();
     &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var order &lt;span class="kwrd"&gt;in&lt;/span&gt; orders)
     {
         Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Id: {0}&amp;quot;&lt;/span&gt;, order.Id);
         Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Customer: {0}&amp;quot;&lt;/span&gt;, order.Customer);
         &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var orderLine &lt;span class="kwrd"&gt;in&lt;/span&gt; order.OrderLines)
         {
             Console.WriteLine(&lt;span class="str"&gt;&amp;quot;Product: {0} x {1}&amp;quot;&lt;/span&gt;, orderLine.ProductId, orderLine.Quantity);
         }
     }
 }&lt;/pre&gt;
    &lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/li&gt;

  &lt;li&gt;Which gives this output: 
    &lt;br /&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/RavenDBHelloWorld_ACFB/image_thumb_8.png" width="362" height="129" /&gt;&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is all, we have seen how we can read, write and query Raven. We worked with the client API and seen how we can persist .NET entities into Raven.&lt;/p&gt;</description>
      <link>/tutorials/hello-world</link>
      <pubDate>Wed, 11 May 2011 05:57:04 GMT</pubDate>
    </item>
    <item>
      <title>Raven - Deploying to IIS</title>
      <description>&lt;div&gt;Raven can be run as an IIS application. &lt;/div&gt;  &lt;h3&gt;Installing Raven in IIS&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Extract the distribution zip. &lt;/li&gt;    &lt;li&gt;In IIS Manager, create a new Web Site and point its physical path to the &amp;quot;/Web&amp;quot; folder in the extracted folder. &lt;/li&gt;    &lt;li&gt;Set the Application Pool to &amp;quot;ASP.Net v4.0&amp;quot; (or create a new Application Pool set to .NET 4.0 Integrated Pipeline) &lt;/li&gt;    &lt;li&gt;Set port and host, if you need them. &lt;/li&gt;    &lt;li&gt;Make sure that the user you set for the site has write access to the physical database location. &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Setting up on IIS 7.5&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Remove the WebDAVModule from the installed Modules in your server &lt;/li&gt;    &lt;li&gt;If you wish to run with authentication      &lt;ul&gt;       &lt;li&gt;Ensure that &amp;quot;Windows Authentication&amp;quot; is installed support to IIS 7.5 (by default it is not) &lt;/li&gt;        &lt;li&gt;Enable &amp;quot;Windows Authentication&amp;quot;&amp;#160; for the RavenDB website. &lt;/li&gt;        &lt;li&gt;In the web.config file, set the app settings value&amp;#160; &amp;quot;Raven/AnonymousAccess&amp;quot; to Get or None &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;If you with to run with no authentication      &lt;ul&gt;       &lt;li&gt;In the web.config file, set the app settings value&amp;#160; &amp;quot;Raven/AnonymousAccess&amp;quot; to All &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Setting up on IIS 6&lt;/h3&gt;  &lt;p&gt;On IIS 6, you need to modify the Web.config and remove the system.webServer element and add the following system.web element:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
               &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;httpHandlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;verb&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt; 
                                &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Raven.Web.ForwardToRavenRespondersFactory, Raven.Web&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
               &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;httpHandlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;&lt;/pre&gt;

&lt;h3&gt;Web Configuration&lt;/h3&gt;

&lt;div&gt;You can set the following configuration options in the Web.config appSettings:&lt;/div&gt;

&lt;div&gt;
  &lt;ul&gt;
    &lt;li&gt;Raven/DataDir - The physical location for the Raven data directory. &lt;/li&gt;

    &lt;li&gt;Raven/AnonymousAccess - What access rights anonymous users have. The default is Get (anonymous users can only read data). The other options are None and All. &lt;/li&gt;

    &lt;li&gt;Raven/Port - The port that Raven will listen to. The default is 8080. &lt;/li&gt;

    &lt;li&gt;Raven/VirtualDirectory - The virtual directory that Raven will listen to. The default is empty. &lt;/li&gt;

    &lt;li&gt;Raven/PluginsDirectory - The plugin directory for extending Raven. The default is a directory named &amp;quot;Plugins&amp;quot; under Raven base directory. &lt;/li&gt;

    &lt;li&gt;Raven/MaxPageSize - The maximum number of results a Raven query can return (overrides any page size set by the client). The default is 1024. &lt;/li&gt;
  &lt;/ul&gt;

  &lt;h3&gt;&amp;#160;&lt;/h3&gt;

  &lt;h3&gt;Recommended IIS Configuration&lt;/h3&gt;
&lt;/div&gt;

&lt;div&gt;Raven isn't a typical web site because it needs to be running at all times. In IIS 7.5, you can set this using the following configuration settings:&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;If you created a dedicated application pool for Raven, change the application pool configuration in the application host file (&lt;span style="font-family: arial; font-size: small"&gt;C:\Windows\System32\inetsrv\config\applicationHost.config)&lt;/span&gt; to: 

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;RavenApplicationPool&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;managedRuntimeVersion&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;v4.0&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;startMode&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;AlwaysRunning&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;li&gt;If Raven runs in an application pool with other sites, modify the application host file (&lt;span style="font-family: arial; font-size: small"&gt;C:\Windows\System32\inetsrv\config\applicationHost.config) to: 
      &lt;br /&gt;

      &lt;br /&gt;&lt;/span&gt;

    &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;application&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;/Raven&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;serviceAutoStartEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
    &lt;style type="text/css"&gt;







.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/li&gt;
&lt;/ul&gt;</description>
      <link>/documentation/docs-deployment-iis</link>
      <pubDate>Mon, 18 Apr 2011 14:47:56 GMT</pubDate>
    </item>
    <item>
      <title>Configuration options</title>
      <description>&lt;p&gt;All the configuration options detailed below are defined in the app.config's &amp;lt;appSettings&amp;gt; as separate values.&lt;/p&gt;  &lt;h4&gt;Core settings:&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/BackgroundTasksPriority&lt;/strong&gt;       &lt;br /&gt;What thread priority to give the various background tasks RavenDB uses (mostly for indexing)       &lt;br /&gt;Allowed values: Lowest, BelowNormal, Normal, AboveNormal, Highest       &lt;br /&gt;Default: Normal &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/MaxPageSize        &lt;br /&gt;&lt;/strong&gt;The maximum allowed page size for queries.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;1024       &lt;br /&gt;Minimum: 10 &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;&lt;strong&gt;Index settings:&lt;/strong&gt;&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/MaxNumberOfParallelIndexTasks&lt;/strong&gt;       &lt;br /&gt;The maximum number of indexing tasks allowed to run in parallel       &lt;br /&gt;Default: the number of processors in the current machine &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/MaxNumberOfItemsToIndexInSingleBatch&lt;/strong&gt;       &lt;br /&gt;Max number of items to take for indexing in a batch       &lt;br /&gt;Default: 2500       &lt;br /&gt;Minimum: 128 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TempIndexPromotionMinimumQueryCount        &lt;br /&gt;&lt;/strong&gt;How many times a temporary, auto-generated index has to be accessed before it can be promoted to be a permanent one       &lt;br /&gt;Default: 100 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TempIndexPromotionThreshold        &lt;br /&gt;&lt;/strong&gt;Time (in milliseconds) the index has to be queried at least once in order for it to become permanent       &lt;br /&gt;Default: 60000 (once per minute) &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TempIndexCleanupPeriod        &lt;br /&gt;&lt;/strong&gt;How often to run the temporary index cleanup process (in seconds)       &lt;br /&gt;Default: 600 (10 minutes) &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TempIndexCleanupThreshold        &lt;br /&gt;&lt;/strong&gt;How much time in seconds to wait after a temporary index has been used before removing it if no further calls were made to it during that time       &lt;br /&gt;Default: 1200 (20 minutes)&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TempIndexInMemoryMaxMB       &lt;br /&gt;&lt;/strong&gt;Temp indexes are kept in memory until they reach this integer value in MB      &lt;br /&gt;Default: 25 MB      &lt;br /&gt;Minimum: 1 MB&lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Data settings:&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/RunInMemory        &lt;br /&gt;&lt;/strong&gt;Should RavenDB's storage be in-memory. If set to true, Munin would be used as the storage engine, regardless of what was specified for StorageTypeName       &lt;br /&gt;Allowed values: true/false       &lt;br /&gt;Default: false &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/DataDir        &lt;br /&gt;&lt;/strong&gt;The directory for the RavenDB database.       &lt;br /&gt;You can use the ~\ prefix to refer to RavenDB's base directory.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;~\Data &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/StorageTypeName        &lt;br /&gt;&lt;/strong&gt;What storage type to use (see: RavenDB Storage engines)       &lt;br /&gt;Allowed values: esent, munin (at this point of time only Esent is fully supported by RavenDB)       &lt;br /&gt;Default: esent &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/TransactionMode        &lt;br /&gt;&lt;/strong&gt;What sort of transaction mode to use.       &lt;br /&gt;Allowed values:       &lt;br /&gt;Lazy - faster, but can result in data loss in the case of server crash.       &lt;br /&gt;Safe - slower, but will never lose data       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; Safe &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Http settings:&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/HostName        &lt;br /&gt;&lt;/strong&gt;The hostname to use when creating the http listener (null to accept any hostname or address)       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;none, binds to all host names &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Port        &lt;br /&gt;&lt;/strong&gt;The port to use when creating the http listener.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;8080 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/VirtualDirectory        &lt;br /&gt;&lt;/strong&gt;The virtual directory to use when creating the http listener.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;/ &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/HttpCompression        &lt;br /&gt;&lt;/strong&gt;Whether to use http compression or not.       &lt;br /&gt;Allowed values: true/false;       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; true &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/AccessControlAllowOrigin        &lt;br /&gt;&lt;/strong&gt;Determine the value of the Access-Control-Allow-Origin header sent by the server.       &lt;br /&gt;Allowed values: null (don't send the header), *, &lt;a href="http://example.org"&gt;http://example.org&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/AnonymousUserAccessMode&lt;/strong&gt;       &lt;br /&gt;Defines which operations are allowed for anonymous users.       &lt;br /&gt;Allowed values: All, Get, None       &lt;br /&gt;Default: Get &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Misc settings:&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/PluginsDirectory        &lt;br /&gt;&lt;/strong&gt;Where to look for plugins for RavenDB.       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; ~\Plugins &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/WebDir&lt;/strong&gt;       &lt;br /&gt;The directory to search for RavenDB's WebUI.       &lt;br /&gt;&lt;em&gt;This is usually only useful if you are debugging RavenDB's WebUI.&lt;/em&gt;       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; ~/Raven/WebUI &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;Esent settings:&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Raven/Esent/CacheSizeMax        &lt;br /&gt;&lt;/strong&gt;The maximum size of the in memory cache that is used by the storage engine. The value is in megabytes.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;1024 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Esent/MaxVerPages        &lt;br /&gt;&lt;/strong&gt;The maximum size of version store (in memory modified data) available. The value is in megabytes.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;128 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Esent/DbExtensionSize        &lt;br /&gt;&lt;/strong&gt;The size that the database file will be enlarged with when the file is full. The value is in megabytes.       &lt;br /&gt;Lower values result in smaller file size, but slower performance.       &lt;br /&gt;&lt;em&gt;Default: &lt;/em&gt;16 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Esent/LogFileSize        &lt;br /&gt;&lt;/strong&gt;The size of the database log file. The value is in megabytes.       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; 16 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Esent/LogBuffers        &lt;br /&gt;&lt;/strong&gt;The size of the in memory buffer for transaction log.       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; 16 &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Raven/Esent/MaxCursors        &lt;br /&gt;&lt;/strong&gt;The maximum number of cursors allowed concurrently.       &lt;br /&gt;&lt;em&gt;Default:&lt;/em&gt; 2048 &lt;/li&gt; &lt;/ul&gt;</description>
      <link>/documentation/configuration</link>
      <pubDate>Sun, 17 Apr 2011 17:10:39 GMT</pubDate>
    </item>
    <item>
      <title>How the indexes work</title>
      <description>&lt;p&gt;In order to allow fast queries over your indexes, RavenDB processes them in the background, executing the queries against the stored documents and persisting the results to a Lucene index. &lt;a href="http://lucene.apache.org/java/docs/index.html"&gt;Lucene&lt;/a&gt; is a full text search engine library (Raven uses the &lt;a href="http://lucene.apache.org/lucene.net/"&gt;.NET version&lt;/a&gt;) which allows us to perform lightning fast full text searches.&lt;/p&gt;  &lt;p&gt;The best way of thinking about RavenDB's indexes is to imagine them as a database's materialized views. RavenDB executes the indexing processes in the background, and the results are written to disk. That means that when we are querying, we have to do very little work. This is how RavenDB manages to achieve its near instantaneous replies for your queries, it doesn't have to think, all the processing has already been done.&lt;/p&gt;  &lt;p&gt;By using Lucene as the indexing format, we can support some really fancy querying types: Range based, partial string matching, full text searches, etc. You can read more about queries supported by Lucene &lt;a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;If you are using the Raven Client API, you can simply use the Linq provider that comes with it and it will deal with most of those issues for you. If you want to query RavenDB externally, or if you want to understand how Raven manages those indexes and take advantage of advanced Lucene features, please read on.&lt;/p&gt;  &lt;p&gt;When RavenDB needs to store the results of your queries in the Lucene index, it analyzes each value, and produce the following results:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If the value is null - create a single field with the unanalyzed value 'NULL_VALUE'. &lt;/li&gt;    &lt;li&gt;If the value is string - create a single field with the supplied name and the value. &lt;/li&gt;    &lt;li&gt;If the value is set unanalyzed - create a single field with the value set to not analyzed. &lt;/li&gt;    &lt;li&gt;If the value is date, create a single field with millisecond precision with the supplied name. &lt;/li&gt;    &lt;li&gt;If the value is numeric (int, long, double, decimal, or float) will create two fields:      &lt;ul&gt;       &lt;li&gt;The first will be created with the supplied name, containing the numeric value as an unanalyzed string. This is useful if you want to query the by the exact value. &lt;/li&gt;        &lt;li&gt;The second will be create with the name: '[name]_Range', containing the numeric value in a form that allows range queries. &lt;/li&gt;        &lt;li&gt;Sample, if we try to index 'Age', 18, we will have the following fields:          &lt;ul&gt;           &lt;li&gt;Age:18 &lt;/li&gt;            &lt;li&gt;Age_Range: [18 in a binary format that is applicable for range searching] &lt;/li&gt;         &lt;/ul&gt;       &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Using this format, it is pretty easy to perform both exact queries and range queries, including when you need to detect nulls.&lt;/p&gt;  &lt;h4&gt;&amp;#160;&lt;/h4&gt;  &lt;h4&gt;Using custom analyzers&lt;/h4&gt;  &lt;p&gt;Lucene uses Analyzers to split up text into the &lt;em&gt;tokens&lt;/em&gt; that are then stored in the index. Normally the default analyzers is okay, but Raven lets you specify which built-in Lucene analyzer to use, in the case when the default analyzer isn't suitable. You can control the analyzer per-field like so:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;store.DatabaseCommands.PutIndex(&lt;span class="str"&gt;&amp;quot;Movies&amp;quot;&lt;/span&gt;,
        &lt;span class="kwrd"&gt;new&lt;/span&gt; IndexDefinition
        {
            Map = &lt;span class="str"&gt;&amp;quot;from movie in docs.Movies select new { movie.Name, movie.Tagline }&amp;quot;&lt;/span&gt;,
            Analyzers =
                {
                    {&lt;span class="str"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(SimpleAnalyzer).FullName},
                    {&lt;span class="str"&gt;&amp;quot;Tagline&amp;quot;&lt;/span&gt;, &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(StopAnalyzer).FullName},                                    
                }
        });&lt;/pre&gt;
&lt;style type="text/css"&gt;









.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The output of the built-in analyzers are shown below, they are all tokenizing the following text:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The quick brown fox jumped over the lazy dog, bob@hotmail.com 123432.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Keyword Analyzer&lt;/strong&gt; - tokenizes the entire stream as a single token. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;[The quick brown fox jumped over the lazy dog, bob@hotmail.com 123432.]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Whitespace Analyzer - &lt;/strong&gt;tokenizes on white space only (note the punctuation at the end of &amp;quot;dog&amp;quot;) &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;[The]&amp;#160;&amp;#160; [quick]&amp;#160;&amp;#160; [brown]&amp;#160;&amp;#160; [fox]&amp;#160;&amp;#160; [jumped]&amp;#160;&amp;#160; [over]&amp;#160;&amp;#160; [the]&amp;#160;&amp;#160; [lazy]&amp;#160;&amp;#160; [dog,]&amp;#160;&amp;#160; [bob@hotmail.com]&amp;#160;&amp;#160; [123432.]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Stop Analyzer&lt;/strong&gt; - strips out common English words (such as &amp;quot;and&amp;quot;, &amp;quot;at&amp;quot; etc), tokenizes letters only and converts everything to lower case &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;[quick]&amp;#160;&amp;#160; [brown]&amp;#160;&amp;#160; [fox]&amp;#160;&amp;#160; [jumped]&amp;#160;&amp;#160; [over]&amp;#160;&amp;#160; [lazy]&amp;#160;&amp;#160; [dog]&amp;#160;&amp;#160; [bob]&amp;#160;&amp;#160; [hotmail]&amp;#160;&amp;#160; [com]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Simple Analyzer&lt;/strong&gt; - only tokenizes letters and makes all tokens lower case &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;[the]&amp;#160;&amp;#160; [quick]&amp;#160;&amp;#160; [brown]&amp;#160;&amp;#160; [fox]&amp;#160;&amp;#160; [jumped]&amp;#160;&amp;#160; [over]&amp;#160;&amp;#160; [the]&amp;#160;&amp;#160; [lazy]&amp;#160;&amp;#160; [dog]&amp;#160;&amp;#160; [bob]&amp;#160;&amp;#160; [hotmail]&amp;#160;&amp;#160; [com]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Standard Analyzer&lt;/strong&gt; - simple tokenizer that uses a stop list of common English works, also handles numbers and emails addresses correctly &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;[quick]&amp;#160;&amp;#160; [brown]&amp;#160;&amp;#160; [fox]&amp;#160;&amp;#160; [jumped]&amp;#160;&amp;#160; [over]&amp;#160;&amp;#160; [lazy]&amp;#160;&amp;#160; [dog]&amp;#160;&amp;#160; [bob@hotmail.com]&amp;#160;&amp;#160; [123432] &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A simple way to see how text is tokenized by the Lucene analyzers is to use the tool available &lt;a href="http://www.codeproject.com/KB/cs/lucene_analysis.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also create your own custom analyzer, compile it to a dll and drop it in in directory called &amp;quot;Analyzers&amp;quot; under the RavenDB base directory. Afterward, you can then use the fully qualified type name of your custom analyzer as the analyzer for a particular field.&lt;/p&gt;</description>
      <link>/documentation/how-indexes-work</link>
      <pubDate>Thu, 14 Apr 2011 08:50:35 GMT</pubDate>
    </item>
    <item>
      <title>Tutorials</title>
      <description>&lt;h3&gt;Videos &amp;amp; Presentations&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;From Raven DB launch event - &lt;a href="http://skillsmatter.com/podcast/open-source-dot-net/ayende-rahien-introduction-into-raven-db"&gt;Fly, Raven, Fly&lt;/a&gt;! &lt;/li&gt;    &lt;li&gt;A presentation in Melbourne Users Group &lt;a href="http://vimeo.com/17352893"&gt;Hello RavenDB&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;RavenDB presentation for the European Virtual Alt.NET&amp;#160; - &lt;a href="http://vimeo.com/18708232"&gt;RavenDB&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;On site tutorials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://ravendb.net/tutorials/hello-world"&gt;Getting started - Raven DB's Hello world&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://builds.hibernatingrhinos.com/builds/RavenDBBook"&gt;The RavenDB book&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;External tutorials&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;p&gt;Fitzchak's RavenDB in practice series:&lt;/p&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;a href="http://blogs.hibernatingrhinos.com/archive/2011/04/10/ravendb-in-practice-part-1-an-introduction-to-ravendb.aspx"&gt;Part 1: An introduction to RavenDB&lt;/a&gt;&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;     &lt;p&gt;By &lt;a href="http://codeofrob.com/"&gt;Rob Ashton&lt;/a&gt;:&lt;/p&gt;   &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;a href="http://codeofrob.com/archive/2010/09/28/ravendb-image-gallery-project-i.aspx"&gt;The image gallery project&lt;/a&gt;, a series of blog posts describing the creation of an image gallery website step-by-step. Source code is &lt;a href="http://github.com/robashton/RavenGallery/"&gt;here&lt;/a&gt;.&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;a href="http://codeofrob.com/archive/2010/05/09/ravendb-an-introduction.aspx"&gt;Raven DB - An Introduction&lt;/a&gt; (outdated)&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;     &lt;p&gt;&lt;a href="http://www.codecapers.com/post/Using-RavenDB-with-ASPNET-MVC.aspx"&gt;Using RavenDB with ASP.NET MVC&lt;/a&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Sample applications&lt;/h3&gt;  &lt;p&gt;Raven comes with the following sample applications:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Shard Client - Sample of using Raven's Sharding and Master/Master replication &lt;/li&gt;    &lt;li&gt;Failover - Sample of Raven's transparent&amp;#160; failover &lt;/li&gt;    &lt;li&gt;Replication - Sample of Raven's Master/Slave replication, conflict detection and recovery &lt;/li&gt;    &lt;li&gt;Event Sourcing - Sample of Raven's event sourcing and compiled indexes capabilities. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All those samples are included in the Raven zip file, which you can &lt;a href="http://ravendb.net/download"&gt;download here&lt;/a&gt;.&lt;/p&gt;</description>
      <link>/tutorials</link>
      <pubDate>Thu, 14 Apr 2011 08:40:35 GMT</pubDate>
    </item>
    <item>
      <title>Denormalized References</title>
      <description>&lt;p&gt;RavenDB doesn't allow references between documents in the sense that an RDBMS user will understand them. Moreover, while RavenDB offers the &lt;em&gt;Includes&lt;/em&gt; feature, document isolation is still an important design feature when you build you data model. &lt;/p&gt;  &lt;p&gt;Consider the following case:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ravendb.net/Uploads/WindowsLiveWriter/DenormalizedReferences_7CA8/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/WindowsLiveWriter/DenormalizedReferences_7CA8/image_thumb.png" width="437" height="160" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Order has a reference to the customer. However, the above is the &lt;em&gt;logical &lt;/em&gt;model, which ignores the persistence concerns. The model we use to store the data in RavenDB is by necessity different. We can't hold a direct reference to the customer, because RavenDB will serialize the entire Customer with our Order, which isn't what we want.&lt;/p&gt;  &lt;p&gt;On the other hand, holding just the document id (common in RDBMS systems) is usually going to be insufficient. A document should contain all the data that is required to perform all routine operations on it. In the case of the Order, that means displaying the Customer's name. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font style="background-color: #ffffff"&gt;From our experiences, it seems that the vast majority of cases requires just holding a name/id pair as a denormalized reference for a document. There are cases where we need more, certainly, but the method outline here works for those as well.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In other words, we need to hold in the Order class what we call a denormalized reference to the customer. That reference includes the document id, but it also include any properties that are important for the Order. In this case, the name.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font style="background-color: #ffffff"&gt;&lt;strong&gt;What properties should be included in the denormalized reference?&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;&lt;font style="background-color: #ffffff"&gt;Properties which rarely change (such as name, email, etc).&lt;/font&gt; &lt;/li&gt;      &lt;li&gt;&lt;font style="background-color: #ffffff"&gt;Properties that are required for common processing of the referencing document.&lt;/font&gt; &lt;/li&gt;      &lt;li&gt;&lt;font style="background-color: #ffffff"&gt;Properties whose value needs to be separate than the current value in the owner document (Product.Cost is a good example where we want to copy the value to the OrderLine.Cost, so we can keep track if things have changed).&lt;/font&gt; &lt;/li&gt;   &lt;/ul&gt; &lt;/blockquote&gt;  &lt;p&gt;The following shows how we can do this easily using code. First, the model:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; INamedDocument
{
    &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Customer : INamedDocument
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Order : INamedDocument
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; DenormalizedReference&amp;lt;Customer&amp;gt; Customer { get;set;}
}&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Note that the Customer property on the Order is a DenormalizedReference of T. This class looks like this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DenormalizedReference&amp;lt;T&amp;gt; &lt;span class="kwrd"&gt;where&lt;/span&gt; T : INamedDocument
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Id { get; set; }
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Name { get; set; }
    
    &lt;span class="kwrd"&gt;public static &lt;/span&gt;&lt;span class="kwrd"&gt;implicit&lt;/span&gt; &lt;span class="kwrd"&gt;operator&lt;/span&gt; DenormalizedReference&amp;lt;T&amp;gt; (T doc)
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; DenormalizedReference&amp;lt;T&amp;gt;
        {
            Id = doc.Id,
            Name = doc.Name
        }
    }
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;This is pretty simple, except that we use something that you might not have seen before, implicit operators. This is just a C# language feature that tells the compiler that whenever it sees a expression of type T passed where the expected type is DenormalizedReference&amp;lt;T&amp;gt;, the implicit operator will be called to convert it.&lt;/p&gt;

&lt;p&gt;This allows the following code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;Customer customer = GetCurrentCustomer();
var order = &lt;span class="kwrd"&gt;new&lt;/span&gt; Order
{
   Customer = customer &lt;span class="rem"&gt;// implicit operator called here&lt;/span&gt;
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;The result is a more natural approach for working with the denormalized reference. &lt;/p&gt;</description>
      <link>/faq/denormalized-references</link>
      <pubDate>Wed, 13 Apr 2011 08:04:20 GMT</pubDate>
    </item>
    <item>
      <title>Replication</title>
      <description>&lt;p&gt;Raven replication can be enabled by dropping the Raven.Bundles.Replication.dll to Raven's Plugins directory.&lt;/p&gt;  &lt;p&gt;You can read about potential deployment options for the replication bundle here: &lt;a href="http://ravendb.net/documentation/replication/sharding"&gt;Mixing Replication and Sharding&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The replication module will effect the following changes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Track the server the document was originally written on. The replication bundle uses this information to determine if a replicated document is conflicting with the existing document. &lt;/li&gt;    &lt;li&gt;Documents that encountered a conflict would be marked appropriately and will require automated or user involvement to resolve. &lt;/li&gt;    &lt;li&gt;Document deletes result in delete markers, which the replication bundle needs in order to be able to replicate deletes to sibling instances. This is an implementation detail and is not noticeable to clients. &lt;/li&gt;    &lt;li&gt;Several new endpoints will begin responding, including, but not limited to:      &lt;ul&gt;       &lt;li&gt;/replication/replicate &lt;/li&gt;        &lt;li&gt;/replication/lastEtag &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;The replication bundle will create several system documents, including, but not limited to:      &lt;ul&gt;       &lt;li&gt;&lt;em&gt;Raven/Replication/Destinations&lt;/em&gt; - List of servers we need to replicate to &lt;/li&gt;        &lt;li&gt;&lt;em&gt;Raven/Replication/Sources/[server] - &lt;/em&gt;Information about the data replicated from a particular server &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;The replication bundle will not replicate any system documents (whose key starts in Raven/) &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Format of &lt;em&gt;Raven/Replication/Destinations&lt;/em&gt;&lt;/h3&gt;  &lt;p&gt;The destination document format is:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;{      &lt;br /&gt;&amp;#160; &amp;quot;Destinations&amp;quot;: [       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Url&amp;quot;: &amp;quot;http://raven_two:8080/&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; },       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Url&amp;quot;: &amp;quot;http://raven_three:8080/&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; },       &lt;br /&gt;&amp;#160; ]       &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;With an object containing a url per each instance to replicate to. Whenever this document is updated, replication kicks off and start replicating to the updates destination list.&lt;/p&gt;  &lt;h3&gt;How replication works?&lt;/h3&gt;  &lt;p&gt;On every transaction commit, Raven will look up the list of replication destination. For each of the destination, the replication bundle will:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Query the remote instance for the last document that we replicated to that instance. &lt;/li&gt;    &lt;li&gt;Start sending batches of updates that happened since the last replication. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Replication happens in the background and in parallel. &lt;/p&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;What about failures?&lt;/h3&gt;  &lt;p&gt;Because of the way it is designed, a node can fail for a long period of time, and still come up and start accepting everything that it missed in the meanwhile. The Replication Bundle keeps track of only a single data item per each replicating server, the last etag seen from that server. This means that we don't have to worry about missing replication windows.&lt;/p&gt;  &lt;p&gt;When the replication bundle encountered a failure when replicating to a server, it has an intelligent error handling strategy. It is meant to be hands off, so nodes can fail and come back up without any administrative intervention. The strategy is outlined below:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;If this is the first failure encountered, immediately try to replicate the same information again. This is done under the assumption that most failures are transient in nature. &lt;/li&gt;    &lt;li&gt;If the second attempt fails as well, we note the failure (in &lt;em&gt;Raven/Replication/Destinations/[server url]&lt;/em&gt;) &lt;/li&gt;    &lt;li&gt;After ten consecutive failures, Raven will start replicating to this node less often      &lt;ul&gt;       &lt;li&gt;Once every 10 replication cycles, until failure count reaches 100 &lt;/li&gt;        &lt;li&gt;Once every 100 replication cycles, until failure count reaches 1,000 &lt;/li&gt;        &lt;li&gt;Once every 1,000 replication cycles, when failure count is above 1,000 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Any successful replication will reset the failure count, on the assumption that &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Can I bring up a new node and start replicating to it?&lt;/h3&gt;  &lt;p&gt;Yes, you can. You can edit the &lt;em&gt;Raven/Replication/Destinations &lt;/em&gt;document in the replicating instance to add the new node, and the Replication Bundle will immediately start replicating to that server.&lt;/p&gt;  &lt;h3&gt;What about timeouts?&lt;/h3&gt;  &lt;p&gt;By default, the replication bundle have a timeout of 500 ms. You can control that by specifying "Raven/Replication/ReplicationRequestTimeout" in the configuration file &amp;lt;appSettings/&amp;gt; section.&lt;/p&gt;  &lt;p&gt;The default value assumes servers that are near one another, for replication over the WAN, you would likely want to add additional time. Please note that timeout failures for the replication bundle counts as failures, and the replication bundle will reduce the number of replication attempts against a node that fails often.&lt;/p&gt;  &lt;h3&gt;What happen if there is a conflict?&lt;/h3&gt;  &lt;p&gt;In a replicating system, it is possible that two writes to the same document will occur on two different servers, resulting in two independent versions of the same document. When replication occur between these two version, the Replication Bundle is faced with a problem. It has two authentic versions of the same thing, saying different things. At that point, the Replication Bundle will mark that document as conflicting, store all the conflicting documents in a safe place and set the document content to point to the conflicting documents.&lt;/p&gt;  &lt;p&gt;Resolving a conflict is easy, you just need to PUT a new version of the document. On PUT, the Replication Bundle will consider the conflict resolved.&lt;/p&gt;  &lt;p&gt;More details about conflicts are here: &lt;a href="http://ravendb.net/documentation/replication/conflicts"&gt;Dealing with replication conflicts&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;Client integration&lt;/h3&gt;  &lt;p&gt;Raven's Client API will detect and respond appropriately whenever a server has the replication bundle installed. This includes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Detecting that an instance is replicating to another set of instances. &lt;/li&gt;    &lt;li&gt;When that instance is down, will automatically shift to the other instances. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The Raven Client API is quite intelligent in this regard, upon failure, it will:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Assume that the failure is transient, and retry the request. &lt;/li&gt;    &lt;li&gt;If the second attempt fails as well, we record the failure and shift to a replicated node, if available. &lt;/li&gt;    &lt;li&gt;After ten consecutive failures, Raven will start replicating to this node less often      &lt;ul&gt;       &lt;li&gt;Once every 10 requests, until failure count reaches 100 &lt;/li&gt;        &lt;li&gt;Once every 100 requests, until failure count reaches 1,000 &lt;/li&gt;        &lt;li&gt;Once every 1,000 requests, when failure count is above 1,000 &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;On the first successful request, the failure count is reset. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If the second replicated node fails, the same logic applies to it as well, and we move to the third replicated node, and so on. If all nodes fail, an appropriate exception is thrown.&lt;/p&gt;  &lt;p&gt;At a lower level, those are the operations that support replication:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Get - single document and multi documents &lt;/li&gt;    &lt;li&gt;Put &lt;/li&gt;    &lt;li&gt;Delete &lt;/li&gt;    &lt;li&gt;Query &lt;/li&gt;    &lt;li&gt;Rollback &lt;/li&gt;    &lt;li&gt;Commit &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The following operation do &lt;em&gt;not&lt;/em&gt; support replication in the Client API:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;PutIndex &lt;/li&gt;    &lt;li&gt;DeleteIndex &lt;/li&gt; &lt;/ul&gt;</description>
      <link>/documentation/replication</link>
      <pubDate>Tue, 22 Mar 2011 12:11:48 GMT</pubDate>
    </item>
    <item>
      <title>Who is using RavenDB?</title>
      <description>&lt;h3&gt;&lt;a href="http://ravendb.net/testimonials/first"&gt;Case Study - The First RavenDB Deployment&lt;/a&gt;&lt;/h3&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.nomura.com/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="logo180 for web" border="0" alt="logo180 for web" src="http://ravendb.net/Uploads/Windows-Live-Writer/Testimonials_E2D1/logo180%20for%20web_3.gif" width="240" height="53" /&gt;&lt;/a&gt;&amp;#160;&lt;a href="http://www.universumglobal.com/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/Windows-Live-Writer/Testimonials_E2D1/image_5.png" width="177" height="52" /&gt;&lt;/a&gt;&lt;a href="http://www.softia.se/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/Windows-Live-Writer/Testimonials_E2D1/image_7.png" width="182" height="54" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;a href="http://sonatribe.com/"&gt;&lt;img border="0" src="http://sonatribe.com/Public/Images/Sonatribe.png" /&gt;&lt;/a&gt;&lt;a href="http://tardisbank.com"&gt;&lt;img style="border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://ravendb.net/Uploads/Windows-Live-Writer/Testimonials_E2D1/image_3.png" width="293" height="79" /&gt;&lt;/a&gt;</description>
      <link>/testimonials</link>
      <pubDate>Tue, 22 Mar 2011 07:37:31 GMT</pubDate>
    </item>
    <item>
      <title>Case Study: The First RavenDB Deployment</title>
      <description>&lt;b&gt;   &lt;p&gt;1.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Who are you? (Name, company, position)&lt;/p&gt; &lt;/b&gt;  &lt;p&gt;Henning Christiansen, Senior Consultant at Webstep Fokus, Norway (&lt;a href="http://www.webstep.no/"&gt;www.webstep.no&lt;/a&gt;) I am working on a development team for a client in the financial sector. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;2.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; In what kind of project / environment did you deploy RavenDB?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;The client is, naturally, very focused on delivering solutions and value to the business at a high pace. The solutions we build are both for internal and external end users. On top of the result oriented environment, there is a heavy focus on building sustainable and maintainable solutions. It is crucial that modules can be changed, removed or added in the future.&amp;#160; &lt;/p&gt;  &lt;p&gt;In this particular project, we built a solution based on NServiceBus for communication and RavenDB for persistence. This project is part of a larger development effort, and integrates with both old and new systems. The project sounds unimpressive when described in short, but I'll give it a go: &lt;/p&gt;  &lt;p&gt;The project's main purpose was to replace an existing system for distribution of financial analysis reports. Analysts/researchers work on reports, and submit them to a proprietary system which adds additional content such as tables and graphs of relevant financial data, and generates the final report as XML and PDF. One of the systems created during this project is notified when a report is submitted, pulls it out of the proprietary system, tags it with relevant metadata and stores it in a RavenDB instance before notifying subscribing systems that a new report is available. The reports are instantly available on the client's website for customers with research access.&amp;#160; &lt;/p&gt;  &lt;p&gt;One of the subscribing systems is the distribution system which distributes the reports by email or sms depending on the customer's preferences. The customers have a very fine-grained control over their subscriptions, and can filter them on things such as sector, company, and report type among other things. The user preferences are stored in RavenDB. When a user changes preferences, notifications are given to other systems so that other actions can be performed based on what the customers are interested in. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;3.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What made you select a NoSQL solution for your project?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;We knew the data would be read a lot more than it would be written, and it needed to be read fast. A lot of the team members were heavily battle-scarred from struggling with ORMs in the past, and with a very tight deadline we weren't very interested in spending a lot of time maintaining schemas and mappings.&amp;#160; &lt;/p&gt;  &lt;p&gt;Most of what we would store in this project could be considered a read model (à la CQRS) or an aggregate root (DDD), so a NoSQL solution seemed like a perfect fit. Getting rid of the impedance mismatch couldn't hurt either. We had a lot of reasons that nudged us in the direction of NoSQL, so if it hadn't been RavenDB it would have been something else. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;4.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What made you select RavenDB as the NoSQL solution?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;It was the new kid on the block when the project started, and had a few very compelling features such as a native .NET API which is maintained and shipped with the database itself. Another thing was the transaction support. A few of us had played a bit with RavenDB, and compared to other NoSQL solutions it seemed like the most hassle-free way to get up and running in a .NET environment. We were of course worried about RavenDB being in an early development stage and without reference projects, so we had a plan B in case we should hit a roadblock with RavenDB. Plan B was never put into action. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;5.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; How did you discover RavenDB?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I subscribe to your blog (&lt;a href="http://ayende.com/Blog/"&gt;http://ayende.com/Blog/&lt;/a&gt;) :) &lt;/p&gt;  &lt;p&gt;There was a lot of fuss about NoSQL at the time, and RavenDB received numerous positive comments on Twitter and in blog posts. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;6.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; How long did it take to learn to use RavenDB?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I assume you're asking about the basics, as there's a lot to be learnt if you want to. What the team struggled with the most with was indexes. This was before dynamic indexes, so we had to define every index up front, and make sure they were in the database before querying. Breaking free from the RDBMS mindset and wrapping our heads around how indexes work, map/reduce, and how and when to apply the different analyzers took some time, and the documentation was quite sparse back then. The good thing is that you don't really need to know a lot about this stuff to be able to use RavenDB on a basic level. &lt;/p&gt;  &lt;p&gt;The team members were differently exposed to RavenDB, so guessing at how long it took to learn is hard. But in general I think it's fair to say that indexes was the team's biggest hurdle when learning how to use RavenDB.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;7.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What are you doing with RavenDB?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;On this particular project we weren't using a lot of features, as we were learning to use RavenDB while racing to meet a deadline. &lt;/p&gt;  &lt;p&gt;Aside from storing documents, we use custom and dynamic indexes, projections, the client API, and transactions. We're also doing some hand-rolled Lucene queries. &lt;/p&gt;  &lt;p&gt;On newer projects however, with more experience and confidence with RavenDB, and as features and bundles keep on coming, we're doing our best to keep up with the development and making the best use of RavenDB's features to solve our problems. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;8.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What was the experience, compared to other technologies?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;For one thing, getting up and running with RavenDB is super-easy and only takes a couple of minutes. This is very different from the RDBMS+ORM experience, which in comparison seems like a huge hassle. Working with an immature and rapidly changing domain model was also a lot easier, as we didn't need to maintain mappings. Also, since everything is a document, which in turn easily maps to an object, you're sort of forced to always work through your aggregate roots. This requires you to think through your domain model perhaps a bit more carefully than you'd do with other technologies which might easier allow you to take shortcuts, and thus compromise your domain model. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;9.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What do you consider to be RavenDB strengths?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;It's fast, easy to get started with, and it has a growing community of helpful and enthusiastic users. Our support experience has also been excellent, any issues we've had have usually been fixed within hours. The native .NET API is also a huge benefit if you're working in a .NET environment &lt;/p&gt;  &lt;p&gt;&lt;b&gt;10.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What do you consider to be RavenDB weaknesses?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;If we're comparing apples to apples, I can't think of any weaknesses compared to the other NoSQL solutions out there aside from the fact that it's new. Hence it's not as heavily tested in production environments as some of the older NoSQL alternatives might be. The relatively limited documentation, which admittedly has improved tremendously over the last few months, was also a challenge. The community is very helpful, so anything you can't find in the documentation can normally be answered by someone on the forum. There's also a lot of blog posts and example applications out there. &lt;/p&gt;  &lt;p&gt;I find the current web admin UI a bit lacking in functionality, but hopefully the new Silverlight UI will take care of that. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;11.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Now that you are in production, do you think that choosing RavenDB was the right choice?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;Yes, definitely. We've had a few pains and issues along the way, but that's the price you have to pay for being an early adopter. They were all quickly sorted out, and now everything's been ticking along like clockwork for months. I'm confident that choosing RavenDB over another persistence technology has allowed us to develop faster and spend more time on the problem at hand. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;12.&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; What would you tell other developers who are evaluating RavenDB?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I have little experience with other document databases, but obviously tested a bit and read blog posts when evaluating NoSQL solutions for this project. Since we decided to go with RavenDB there's been a tremendous amount of development done, and at this time none of the competitors are even close featurewise. &lt;/p&gt;</description>
      <link>/testimonials/first</link>
      <pubDate>Tue, 22 Mar 2011 07:36:43 GMT</pubDate>
    </item>
    <item>
      <title>Patching documents via the client API</title>
      <description>&lt;p&gt;RavenDB supports document patching, a process which is described in full &lt;a href="http://www.ravendb.net/documentation/docs-http-api-patch"&gt;here&lt;/a&gt;. This feature allows us to modify a document without having to get and put the entire document. This can save bandwidth, as well as reduce the potential for concurrency conflicts.&lt;/p&gt;  &lt;p&gt;For example, let us consider the scenario of wanting to add a comment to a blog post. Using the standard API, we would use:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;var post = session.Load&amp;lt;Post&amp;gt;(&lt;span class="str"&gt;&amp;quot;posts/123&amp;quot;&lt;/span&gt;);
post.Comments.Add(comment);
session.SaveChanges();&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;This load and saves the entire document, as a single unit. But we can also just instruct RavenDB to just add the new comment to the post, using the following code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;session.Advanced.DatabaseCommands.Batch(
    &lt;span class="kwrd"&gt;new&lt;/span&gt;[]
    {
        &lt;span class="kwrd"&gt;new&lt;/span&gt; PatchCommandData
        {
            Key = &lt;span class="str"&gt;&amp;quot;posts/123&amp;quot;&lt;/span&gt;,
            Patches = &lt;span class="kwrd"&gt;new&lt;/span&gt;[]
            {
                &lt;span class="kwrd"&gt;new&lt;/span&gt; PatchRequest
                {
                    Type = PatchCommandType.Add,
                    Name = &lt;span class="str"&gt;&amp;quot;Comments&amp;quot;&lt;/span&gt;,
                    Value = JObject.FromObject(comment)
                }, 
            }
        }
    });&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;This will perform the work on the server side. Note that we can pass several patch requests, to make several modifications to the same document all at once.&lt;/p&gt;</description>
      <link>/documentation/client-api/patching</link>
      <pubDate>Sun, 20 Mar 2011 22:33:30 GMT</pubDate>
    </item>
    <item>
      <title>Working with System.Transactions</title>
      <description>&lt;p&gt;fully supports System.Transactions as a durable resource manager. That means that you can write the following code and it will be fully transactional:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt;(var tx = &lt;span class="kwrd"&gt;new&lt;/span&gt; TransactionScope())
{
   &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
   {
           session.Store(&lt;span class="kwrd"&gt;new&lt;/span&gt; User { Name = &lt;span class="str"&gt;&amp;quot;Ayende&amp;quot;&lt;/span&gt; } );
           session.SaveChanges();
   }
   &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
   {
           session.Store(&lt;span class="kwrd"&gt;new&lt;/span&gt; User { Name = &lt;span class="str"&gt;&amp;quot;Rahien&amp;quot;&lt;/span&gt; } );
           session.SaveChanges();
   }
   tx.Complete();
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;This code will either save both documents, or neither of them.&lt;/p&gt;

&lt;p&gt;That said, the way that System.Transactions is implemented leads to some interesting issues. Let us examine this code:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt;(var tx = &lt;span class="kwrd"&gt;new&lt;/span&gt; TransactionScope())
{
   &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
   {
           var user = session.Load&amp;lt;User&amp;gt;(&lt;span class="str"&gt;&amp;quot;users/1&amp;quot;&lt;/span&gt;);
           user.Name = &lt;span class="str"&gt;&amp;quot;Ayende&amp;quot;&lt;/span&gt;; &lt;font color="#008000"&gt;// old name is &amp;quot;Oren&amp;quot;&lt;/font&gt;
           session.SaveChanges();
   }
   tx.Complete();
}

&lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
{
    var user = session.Load&amp;lt;User&amp;gt;(&lt;span class="str"&gt;&amp;quot;users/1&amp;quot;&lt;/span&gt;);
    Console.WriteLine(user.Name);
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;What would you expect this code to produce? Probably you would expect this to output &amp;quot;Ayende&amp;quot;. But as a matter of fact, &amp;quot;Oren&amp;quot; (the old value) will be outputted.&lt;/p&gt;

&lt;p&gt;That is &lt;em&gt;not&lt;/em&gt; a bug, actually. It is an implication of how System.Transactions work. When you dispose a completed transaction scope, the transaction doesn't actually commit. What happens is that the transaction commit &lt;em&gt;process&lt;/em&gt; is started. Since this is a background process running in another thread, you are actually going to load the users/1 document &lt;em&gt;before&lt;/em&gt; the commit is over, which means that you are going to read the committed value of &amp;quot;Oren&amp;quot; (vs. the uncommitted value &amp;quot;Ayende&amp;quot;).&lt;/p&gt;

&lt;p&gt;It may not be a bug, since everything works as it is designed to work, but it sure isn't clear what is going on. And it &lt;em&gt;looks&lt;/em&gt; like a bug. RavenDB detects this situation and will inform you that the document that you have loaded has been modified by an uncommitted transaction (using 203 Non Authoritative Information as the HTTP response code and &amp;quot;Non-Authoritative-Information&amp;quot; metadata property), so you can decide what to do about it.&lt;/p&gt;

&lt;p&gt;In practice, for most read-only scenarios, we can use the non authoritative value (since we don't want to show uncommitted data, we will show the committed data, even if it is currently being modified). But when we want to update the document, we can't really do that, since the document is being locked by another transaction. If we'll try, we will get a Conflict Exception (409 Conflict on the HTTP response code).&lt;/p&gt;

&lt;p&gt;You can ask RavenDB to wait until the pending transaction fully commits, by setting AllowNonAuthoritativeInformation to false, like this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt;(var tx = &lt;span class="kwrd"&gt;new&lt;/span&gt; TransactionScope())
{
   &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
   {
           var user = session.Load&amp;lt;User&amp;gt;(&lt;span class="str"&gt;&amp;quot;users/1&amp;quot;&lt;/span&gt;);
           user.Name = &lt;span class="str"&gt;&amp;quot;Ayende&amp;quot;&lt;/span&gt;; &lt;span class="rem"&gt;// old name is &amp;quot;Oren&amp;quot;&lt;/span&gt;
           session.SaveChanges();
   }
   tx.Complete();
}

&lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = documentStore.OpenSession())
{
   &lt;strong&gt; session.Advanced.AllowNonAuthoritativeInformation = &lt;span class="kwrd"&gt;false&lt;/span&gt;;
   &lt;/strong&gt; var user = session.Load&amp;lt;User&amp;gt;(&lt;span class="str"&gt;&amp;quot;users/1&amp;quot;&lt;/span&gt;);
    Console.WriteLine(user.Name);
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;

.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;This code will print &amp;quot;Ayende&amp;quot;. &lt;/p&gt;

&lt;p&gt;If the transaction doesn't commit within 15 seconds, an exception is thrown. You can control the timeout by setting the NonAuthoritativeInformationTimeout property on the session.&lt;/p&gt;</description>
      <link>/faq/working-with-dtc</link>
      <pubDate>Wed, 02 Mar 2011 17:55:02 GMT</pubDate>
    </item>
    <item>
      <title>Licensing</title>
      <description>&lt;p&gt;Hibernating Rhinos offers both Open Source and commercial editions of RavenDB.&lt;/p&gt;  &lt;p&gt;Commercial editions can be used in closed source environment and are available under a subscription or perpetual pricing model. Prices are per instance. As long as the subscription is valid, new releases are included in it automatically. &lt;/p&gt;  &lt;h5&gt;What does this means?&lt;/h5&gt;  &lt;p&gt;You can use Raven for free, if your project is Open Source. If you want to use Raven in to build commercial software, you must buy a commercial license.&lt;/p&gt;  &lt;h3&gt;Pricing&lt;/h3&gt;  &lt;table border="0" cellspacing="3" cellpadding="3" width="865"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="255"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="182"&gt;&lt;strong&gt;Cost&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="202"&gt;&lt;strong&gt;Support&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&amp;nbsp;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="255"&gt;&lt;strong&gt;Subscriptions&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="182"&gt;&amp;#160; 25 USD / instance / month&lt;/td&gt;        &lt;td valign="top" width="202"&gt;2 incidents / instance /year&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;a href="https://www.plimus.com/jsp/buynow.jsp?contractId=2821674"&gt;Buy now!&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="255"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="182"&gt; 300 USD / instance / year&lt;/td&gt;        &lt;td valign="top" width="202"&gt;2 incidents / instance /year&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;a href="https://www.plimus.com/jsp/buynow.jsp?contractId=2946068"&gt;Buy now!&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="255"&gt;&lt;strong&gt;One time payment&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="182"&gt;599 USD / instance&lt;/td&gt;        &lt;td valign="top" width="202"&gt;2 incidents / instance for the first 6 months.          &lt;br /&gt;Additional support:           &lt;br /&gt;249 USD instance / year&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;a href="https://www.plimus.com/jsp/buynow.jsp?contractId=2829172"&gt;Buy now!&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="255"&gt;&lt;strong&gt;OEM (embedded only)            &lt;br /&gt;&lt;/strong&gt;Allow royalty free distribution of RavenDB&lt;/td&gt;        &lt;td valign="top" width="182"&gt;999 USD / developer / year          &lt;br /&gt;Renewal:           &lt;br /&gt;549 USD / developer / year&lt;/td&gt;        &lt;td valign="top" width="202"&gt;2 incidents / developer / year          &lt;br /&gt;&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;a href="https://www.plimus.com/jsp/buynow.jsp?contractId=2829176"&gt;Buy now!&lt;/a&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If you are a startup company, open source project, or would like to use RavenDB in a non-commercial closed source project, please &lt;a href="http://hibernatingrhinos.com/contact"&gt;contact us&lt;/a&gt; to request free licensing.&lt;/p&gt;  &lt;h5&gt;Would I be forced to release my OSS projects using Raven under the AGPL?&lt;/h5&gt;  &lt;p&gt;No, Raven's AGPL license contains an explicit exception for OSS projects. You can release your project under any OSI approved license. Note, however, that you can't change Raven's own licensing. Users of your project would still need to comply with Raven's licensing.&lt;/p&gt;</description>
      <link>/licensing</link>
      <pubDate>Wed, 23 Feb 2011 10:13:11 GMT</pubDate>
    </item>
  </channel>
</rss>
