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 7002123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:53:20+00:00 2026-05-27T20:53:20+00:00

While querying RavenDB I am noticing that it does not get the expected results

  • 0

While querying RavenDB I am noticing that it does not get the expected results immediately. May be it has to do with indexing, I dont know.

For example :

   int ACount = session.Query<Patron>()
                   .Count();

   int BCount = session.Query<Theaters>()
                   .Count();

   int CCount = session.Query<Movies>()
                   .Where(x => x.Status == "Released")                                              
                   .Count();

   int DCount = session.Query<Promotions>()
                    .Count();

When I execute this then ACount and BCount get their values immediately on the first run). However CCount and DCount do not get their values until after three or four runs. They show 0 (zero) value in the first few runs.

Why does this happen for bottom two and not top two queries? If its because of stale results (or indexes) then how can I modify my queries to get the accurate results every time, when I run it first time. Thank you for help.

  • 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-05-27T20:53:21+00:00Added an answer on May 27, 2026 at 8:53 pm

    If you haven’t defined an index for the Movies query, Raven will create a Dynamic Index. If you use the query repeatedly the index will be automatically persisted. Otherwise Raven will discard it and that may explain why you’re getting 0 results during the first few runs.

    You can also instruct Raven to wait for the indexing process to ensure that you’ll always get the most accurate results (even though this might not be a good idea as it will slow your queries) by using the WaitForNonStaleResults instruction:

    session.Query<Movies>()
    .Customize(x => x.WaitForNonStaleResults())
    .Where(x => x.Status == "Released")                                              
    .Count();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While the C# spec does include a pre-processor and basic directives (#define, #if, etc),
i am getting an error while querying this select statement. $comments = dbgetvar(SELECT SUM(CASE
While I've been working with querying SQL databases for a while, I'm still quite
I am querying a database to get 6 values in my params table suing
I'm querying a database for names that are numbered 1-26 alphabetically. I have the
Does anyone know of a good open source plugin for database querying and exploring
It is possible to use AND while querying for Objects in Entity like Post.find(byTitleLikeAndAuthor,
I got this error message while querying the top 50 row in a table.
I'd like to expand a question I posted a while ago : I'm querying
I'm querying a mysql table which then loops through the results. One of the

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.