Note that there are some explanatory texts on larger screens.

plurals
  1. POUnsolvable events scenario in RavenDB?
    primarykey
    data
    text
    <p><strong>Edit</strong>. Here's a simplified description of the issue: I have events</p> <pre><code>class Event { Id = 0, Dates = new DateTime[] {} } </code></pre> <p>I need to query for all events within a date range for example (august 1 to october 20). The result shall list uniqe events within this range <strong>ordered by date</strong>. Like this:</p> <pre><code>Event one 2012-08-04,2012-09-06,2012-09-10 Event two 2012-10-02 etc. </code></pre> <p>I need to be able to page this result. That's it.</p> <hr> <p>I have the following issue with my events using ravendb. I have a document (representing an event) that contains an array of dates, for example 2012-08-20, 2012-08-21, 2012-09-14, 2013-01-05 etc.</p> <pre><code>class Event { Dates = []; } </code></pre> <p>I have a few criteria that must be met:</p> <ol> <li><p>I need to be able to query these documents on a date range. For example find all events that has any date between august 1 and september 22, or october 1 and october 3. </p></li> <li><p>I must be able to sort the query on date</p></li> <li><p>I must be able to page the result.</p></li> </ol> <p>Seems easy enough right? Well I have had two approaches to this but they both fail.</p> <p>Create an index with multiple from. Like so:</p> <pre><code>from event in docs.Events from date in event.Dates select new { Dates = date} </code></pre> <p>This works and is easy to query. However it can't be paged because of skippedresults (the index will contain duplicates of each event). And sorting also fails in combination with paging.</p> <p>...............</p> <p>Create a simple index</p> <pre><code>from event in docs.Events select new { Dates = event.Dates } </code></pre> <p>This also works and is simple to query, it can also be paged. However it cannot be sorted. I need to sort the documents by the first available date within the queried range.</p> <p>If I can't solve this it will probably be a deal breaker for us.. and I really don't want to get started with a new application, besides I really like RavenDB..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload