title: How to create an index returning the input document type?
body: <p>I have a Raven database which contains a document collection. I would like to retrieve a subset of the documents in that collection. Only documents fulfilling certain criteria would be retrieved. However, for each document retrieved, the <em>entire</em> document must be retrieved.</p>
  
  <p>Consider the following document type:</p>
  
  <pre><code>public class MyDocument {
      public string Id { get; set; }
  
      public string Name { get; set; }
      public int Foo { get; set; }
      public string Bar { get; set; }
  }
  </code></pre>
  
  <p>Let's say I would like to retrieve all documents where the Foo property is greater than a given value (unknown at compile/index creation time). Using dynamic indexes, this could be done like:</p>
  
  <pre><code>IList&lt;MyDocument&gt; FindMyDocuments(int minFooValue) {
      using(IDocumentSession session = _store.OpenSession()) {
          return session.Query&lt;MyDocument&gt;().Where(d =&gt; d.Foo &gt; minFooValue).ToList();
      }
  }
  </code></pre>
  
  <p>However, as I understand it, there are benefits to using predefined indexes instead of dynamic indexes. So I would like to define an index for this operation up front. <em>How would an implementation of AbstractIndexCreationTask&lt; MyDocument, MyDocument > look like?</em></p>
  
  <p>The following doesn't seem to work as Raven wants the Map to select a new anonymous type:</p>
  
  <pre><code>class MyDocumentIndex: AbstractIndexCreationTask&lt;MyDocument, MyDocument&gt; {
      public MyDocumentIndex() {
          Map = docs =&gt; from doc from docs
                        select doc;
      }
  }
  </code></pre>
  
  <p>And shouldn't there be a Reduce part as well?</p>
  
  <p>As you probably noticed, I'm rather new to this Map/Reduce concept :-).</p>