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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:06:12+00:00 2026-06-18T12:06:12+00:00

There is a doubt as of how to query or retrieve a value from

  • 0

There is a doubt as of how to query or retrieve a value from an object stored in an document as follows in raven db.

class User
{
       public String Id { get; set; }
       public AccountType AccountType { get; set; }Servicetax
       public String MainAccountMobileNo { get; set; }
       public UserStatus Status { get; set; }
       public String EmailId { get; set; }
       public String DisplayName { get; set; }
       public Object User { get; set; }
}

Here i am storing three different types of classes into the object User.
Say Customer,Retailer and Trader.

Customer

{
           public String Name{ get; set; }
           public String Address { get; set; }
           public String MobileNo { get; set; }
           public String EmailId { get; set; }
}

Retailer

{
           public String Name{ get; set; }
           public String Address { get; set; }
           public String MobileNo { get; set; }
           public String EmailId { get; set; }
}

Trader

{
           public String Name{ get; set; }
           public String Address { get; set; }
           public String MobileNo { get; set; }
           public String EmailId { get; set; }
}

Now is it possible to retrieve results based on the Customer’s class detail?
That is now i want to retrieve All the Customers based on Address in the customer class, So how will i do it? How to typecast the object user in the query to type customer.
Thanks.Image of my document storage

The user object in the document can store any type of class’s object like account info trader in the above image. So how can i query from the object type that cannot is not definite and changing.

var Result = sess.Query<UserAccountInfo>().Where(x => x.AccountType == usertype && ((AccountInfoCustomer)x.User).Customerstatus == CustomerStatus.Pending);

This is the query that’s been tried and this is the exception that’s been caught
{“Url:
\”/indexes/dynamic/UserAccountInfos?query=AccountType%253ADistributor%2520AND%2520User).Customerstatus%253APending&start=0&pageSize=128&aggregation=None\”\r\n\r\nSystem.ArgumentException:
The field ‘)_Customerstatus’ is not indexed, cannot query on fields
that are not indexed\r\n at
Raven.Database.Indexing.Index.IndexQueryOperation.AssertQueryDoesNotContainFieldsThatAreNotIndexes()

  • 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-18T12:06:13+00:00Added an answer on June 18, 2026 at 12:06 pm

    The problem here was the build of raven db. i was using the older build after changing it to newer version the query

    var Result = sess.Query<UserAccountInfo>().Where(x => x.AccountType == usertype && ((AccountInfoCustomer)x.User).Customerstatus == CustomerStatus.Pending);
    

    works fine.

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

Sidebar

Related Questions

I have come across with a doubt regarding stopping (killing) a query: There is
I have a doubt about the object IGrouping that results from a linq where
I have the following doubt. When you have to query a DB from a
I have a doubt whether NSDate can be directly stored or read from the
I have a general doubt .. Is there a way we limit the scope
I have a doubt regarding unions. Suppose there is a union defined as union
I had this doubt for sometime now, some people say that there's no such
My program/process exited abnormally? I doubt something is wrong with the following code: There
I haven't browsed through the spec, though I doubt any info is in there.
i'm new at Android world, and i have a doubt, is there any 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.