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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:26:33+00:00 2026-06-09T18:26:33+00:00

I’m new to RaveDB (Actually I’ve started learn it only yesterday). And try to

  • 0

I’m new to RaveDB (Actually I’ve started learn it only yesterday). And try to implement some functionality.

Lets we have next class hierarchy:

public abstract class Transaction
{
    public string Id { get; set; }
}

public class CategoryTransaction : Transaction
{
    public string AccountId { get; set; }

    public string Name { get; set; }

    public string Category { get; set; }

    public decimal Amount { get; set; }
}

public class ExchangeTransaction : Transaction
{
    public string DebitAccountId { get; set; }

    public string CreditAccountId { get; set; }

    public decimal DebitAmount { get; set; }

    public decimal CreditAmount { get; set; }
}

Everything storing excelent int db. I event add Conventions = FindTypeTagName ... for store documents as ‘transactions/*’ document id.

But I want to create index for select all transactions for specific Account (by field AccountId). I’ve create index:

public class AccountTransactionResult
{
    public string AccId { get; set; }
}

public class Account_Transactions : AbstractMultiMapIndexCreationTask<AccountTransactionResult>
{
    public Account_Transactions()
    {
        this.AddMap<CategoryTransaction>( transactions => from transaction in transactions
                                                            select new
                                                                    {
                                                                    AccId = transaction.AccountId
                                                                    } );
        this.AddMap<ExchangeTransaction>( transactions => from transaction in transactions
                                                            select new
                                                                    {
                                                                    AccId = transaction.DebitAccountId
                                                                    } );
        this.AddMap<ExchangeTransaction>( transactions => from transaction in transactions
                                                            select new
                                                                    {
                                                                    AccId = transaction.CreditAccountId
                                                                    } );
    }
}

This index works well I can’t get all type of transactions from DB (Exchange and Category) as single IEnumerable<Transaction>. That is great.

But I want to use the index to return transactions only for particular account. Because ExchangeTransaction can belong to two Accounts. I want to see ExchangeTransaction for both Accounts. I can make query in Raven Studio by AccId (index field) and it works greate! But I can’t create the same request in the code :(.

Can someone help me? How can I use index field AccId in C# LINQ query?

This code

var query = session.Query<Transaction, Account_Transactions>()

return all type of transaction, but I don’t how to filter the transactions by index field in the DB.

Thanks in advance. And please sorry me my English, it is not my native language.

  • 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-09T18:26:34+00:00Added an answer on June 9, 2026 at 6:26 pm

    My fault, in documentation everythings is clear. I missed some useful paragraph.

    The easiest way to do this is by writing a multi-map index like this
    one:

    public class AnimalsIndex : AbstractMultiMapIndexCreationTask
    {
        public AnimalsIndex()
        {
            AddMap<Cat>(cats => from c in cats
                                select new { c.Name });
    
            AddMap<Dog>(dogs => from d in dogs
                                select new { d.Name });
        }
    }
    

    And query it like this:

    var results = session.Advanced.LuceneQuery<object>("AnimalsIndex")
        .WhereEquals("Name", "Mitzy");
    

    >

    In my case I should use next construction:

    var transactions = session.Advanced.LuceneQuery<Transaction>( "Account/Transactions" )
                        .WhereEquals( "AccId", account2.Id )
    

    And everything is working now.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.