Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:14:55+00:00 2026-06-08T07:14:55+00:00

I have the following code IDocumentSession documentSession = store.OpenSession(); var schools = documentSession.Query<School>().Where(x =>

  • 0

I have the following code

        IDocumentSession documentSession = store.OpenSession();
        var schools = documentSession.Query<School>().Where(x => x.SchoolName == "My Primary School").ToList();
        foreach (var school in schools)
        {
            Console.WriteLine(school);
        }

        schools = documentSession.Query<School>().Where(x => x.Id == "109940").ToList();
        foreach (var school in schools)
        {
            Console.WriteLine(school.SchoolName);  // returns My Primary School
        }

When the first query runs, no records are returned, although I have a matching record in the database. however the second query returns a the record I am expecting. I am running the db as embedded and I havent set up any indexes myself

Update: so if I customise the query to wait for non stale results it works fine, do I need to create a permanent index?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:14:56+00:00Added an answer on June 8, 2026 at 7:14 am

    This is how RavenDB behaves. If there is no index to satisfy your query, RavenDB will create an index dynamically upon the query, and return with a stale results.

    This is why the second time you get the result as you expected. This is one of the key designs of RavenDB, let the indexes do the work on the background and allow stale results rather blocking the query until the index is not stale.

    In production the temp index will be promoted to auto index, once RavenDB will detect that the index has a regular use. Instead of relaying on auto indexes, you can also create a static index at some point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code snipped: ... var tpc = new ThirtPartyClass(); tpc.ExecuteCommand(); tpc.ExecuteCommand(); ...
I have following code that creates Linq query. I've never used Linq until today
I have following code.. $query = SELECT quote, author FROM quotes ORDER BY id
I have following code: <?php $select_options = array(); foreach($delivery_options as $option) { $select_options[$option->getDeviceId()] =
I have following code snippet in c#. var list = new List<string> { a,
I have following code. var mysql = require('mysql'); var connection = mysql.createConnection({ host :
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have following code for loading image from url in xml parsing endElement method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.