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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:13:23+00:00 2026-06-16T13:13:23+00:00

I have a RavenDB Service instance set up on localhost:8080 and am using the

  • 0

I have a RavenDB Service instance set up on localhost:8080 and am using the OAuth plugin to store a simple user document for authentication. I am using a guid for the id and the users email as the name. The following code is functioning properly to store the user

public AccountUserDocument CreateUser(RegisterModel model)
{
    using (IDocumentSession session = DataDocumentStore.Instance.OpenSession())
    {
        Guid userId = Guid.NewGuid();

        session.Store(new AccountUserDocument
            {
                Name = model.Email,
                Id = String.Format("Raven/Users/{0}", userId),
                AllowedDatabases = new[] { "*" },

                Email = model.Email,
                FirstName = model.FirstName,
                LastName = model.LastName,
                FacebookId = 0,
                Expires = DateTime.Now.AddMonths(1),
                AccessToken = string.Empty

            }.SetPassword(model.Password));

        session.SaveChanges();

        return session.Load<AccountUserDocument>
                       (String.Format("Raven/Users/{0}", userId));
    }
}

and returns a valid user object. However, when i call

return session.Query<AccountUserDocument>()
              .Customize(x => x.WaitForNonStaleResults())
              .Where(x => x.Name == email)
              .SingleOrDefault();

I get nothing. It had been working a week ago but now it just doesn’t. If I open up RavenDB studio, I can see the user and the name is exactly how I am entering it (i have even copy and pasted it into the text field).

enter image description here

I have tried stopping and restarting the service hoping that would solve the problem but it did not.

I was wondering if someone could point me in the direction of how I might debug what is going on here. The full code repository can be found here

https://github.com/jamesamuir/MVC_Facebook_Auth

if anyone is inclined to download it.

Thanks in advance.

  • 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-16T13:13:24+00:00Added an answer on June 16, 2026 at 1:13 pm

    Well, I see a lot of things wrong with the code sample you provided – such as mismatched versions of client and server. Also, the Authentication Bundle was a 1.0 feature that has been deprecated in 2.0 which is almost final, so you’re writing code you will eventually have to replace.

    But to answer your question, the specific reason that you can’t get results from your query is that you chose to use a document key starting with “Raven/”, which is the convention for RavenDB system documents – which don’t get indexed.

    If you remove “Raven/” from your id, it will work.

    Also, you should not be using .WaitForNonStaleResults() – that’s only for unit tests, and is dangerous in production. If you really feel like you need to wait, use .WaitForNonStaleResultsAsOfNow() – which is safer because it provides a cutoff.

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

Sidebar

Related Questions

I have a document model to store in RavenDB but I don't want to
I am using the embedded version of RavenDb and have put the physical database
I have integration tests using RavenDB with RunInMemory = true . One of the
I have some behavior that I don't understand. I'm using RavenDB, and I'm using
The sample db that comes with RavenDB has Albums document collection, that each have
I have a document in RavenDB that looks looks like: { ItemId: 1, Title:
I have an Asp.Net MVC3 application that use embedded RavenDB to store data. The
I have documents collection Messages in my base (RavenDB) Document definition like: class Message
I have a requirement for uniqueness of a document in a RavenDb database. So
Say I have the given document structure in RavenDb public class Car { public

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.