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

  • Home
  • SEARCH
  • 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 7720451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:40:41+00:00 2026-06-01T03:40:41+00:00

I am new to using RavenDB and trying to get indexes to work in

  • 0

I am new to using RavenDB and trying to get indexes to work in a simple MVC3 app which allows users to enter geographic locations. I have two models, a UserModel and a LocationModel. The LocationModel stores the UserId when saved and I am trying to create an index on this.

public class Locations_ByUser : AbstractIndexCreationTask<LocationModel>
    {
        public Locations_ByUser()
        {
            Map = locations => from location in locations
                            select new { location.UserId };

        }
    }

I am registering the index with the following code

protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            //ADD THE MODEL BINDER FOR LIST TO STRING
            ModelBinders.Binders.Add(typeof(TestAPI.Models.LocationModel), new TestAPI.Classes.LocationModelBinder());

            //INIT THE STORE, DO ONCE PER APP START
            TestAPI.Classes.DataDocumentStore.Initialize(); 

            //SET THE INDEXES
            IndexCreation.CreateIndexes(typeof(Locations_ByUser).Assembly, TestAPI.Classes.DataDocumentStore.Instance);
        }

However, when i try to call the index from the mvc app

[HttpGet]
        public ActionResult Index()
        {

            var result = this.DocumentSession.Query<LocationModel>("Locations_ByUser").ToList();
            foreach (var userid in result)
            {
                Console.Out.WriteLine(userid);
            }

            return View();
        }

it returns the following error

Could not find index named: Locations_ByUser

I was wondering if anyone else has encountered this before and could point me in the right direction. 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-01T03:40:42+00:00Added an answer on June 1, 2026 at 3:40 am

    The index in RavenDB will actually be named: “Locations/ByUser” when it’s generated.

    If you open up the Raven Studio you can see this under the index’s. The _ is replaced with /

    Also you don’t need to specify the string value, you can write your query like:

    var result = this.DocumentSession.Query<LocationModel, Locations_ByUser>().ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when using new Date,I get something like follows: Fri May 29 2009 22:39:02 GMT+0800
I am new to using SQLite databases and android mobile development. I am trying
I want to mention that I'm new using sql developer and I'm trying to
I am using ravendb 1.0.531 in an MVC 3 app to store my data.
Building a .NET4 app with RavenDB using Mono 2.10.8. When I try to do
I am using RavenDB and allowing a user to enter an item into the
If I insert a new document into RavenDB using a put command and specify
I'm new using the excellent stuff of css twitter bootstrap and having a problem,
I'm new using Yii framework. I show a list a checkbox. But it's not
I still new using Asp.net with vb.net Protected Sub login_Click(ByVal sender As Object, ByVal

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.