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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:58:25+00:00 2026-06-14T21:58:25+00:00

I’m learning RavendDb by using it in a project and trying to do stuff.

  • 0

I’m learning RavendDb by using it in a project and trying to do stuff. I don’t have any background in SQL/relational db experience, which is why I find it easier to use map reduce and document databases.

I am attempting to make one static index to create an object holding the count the occurrence of 4 conditions fields instead of making 4 static indexes and combining the result after 4 database queries.

Here is the static index:

public class Client_ProductDeploymentSummary : AbstractIndexCreationTask<Product, ClientProductDeploymentResult>
{
    public Client_ProductDeploymentSummary()
    {
        Map = products =>
              from product in products
              select new {
                  product.ClientName, 
                  NumberProducts = 1,
                  NumberProductsWithCondition = 0,
                  NumberProductsWithoutCondition = 0,
                  NumberProductsConditionTestInconclusive = 0
              };

        Map = products =>
              from product in products
              where product.TestResults.Condition == true
              select new
              {
                  product.ClientName,
                  NumberProducts = 0,
                  NumberProductsWithCondition = 1,
                  NumberProductsWithoutCondition = 0,
                  NumberProductsConditionTestInconclusive = 0
              };

        Map = products =>
              from product in products
              where product.TestResults.Condition == false
              select new
              {
                  product.ClientName,
                  NumberProducts = 0,
                  NumberProductsWithCondition = 0,
                  NumberProductsWithoutCondition = 1,
                  NumberProductsConditionTestInconclusive = 0
              };

        Map = products =>
              from product in products
              where product.TestResults.Condition == null
              select new
              {
                  product.ClientName,
                  NumberProducts = 0,
                  NumberProductsWithCondition = 0,
                  NumberProductsWithoutCondition = 0,
                  NumberProductsConditionTestInconclusive = 1
              };

        Reduce = results =>
                from result in results
                group result by result.ClientName
                into g
                select new ClientProductDeploymentResult() 
                { 
                    ClientName = g.Key, 
                    NumberProducts = g.Sum(x => x.NumberProducts),
                    NumberProductsWithCondition = g.Sum(x => x.NumberProductsWithCondition),
                    NumberProductsWithoutCondition = g.Sum(x => x.NumberProductsWithoutCondition),
                    NumberProductsConditionTestInconclusive = g.Sum(x => x.NumberProductsConditionTestInconclusive)
                };
    }
}

I added the 4 variables to each select new statements to make the index compile and deploy in my unit test. I can’t seem to use the AddMap(…) function as i’ve seen in some examples (i realize i’m just overwriting the Map variable). There are not so many Clients, in the 10s or 100s, but possibly many Products, definitely in the 1000s per client.

Is there a concise way to construct the intent of this index? Or is one map reduce for each field and combining the results in caller code the better way to go?

  • 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-14T21:58:26+00:00Added an answer on June 14, 2026 at 9:58 pm

    MultiMap indexes have a different base class. You would inherit from AbstractMultiMapIndexCreationTask to create a multimap index.

    However, what you describe here is not suited for multimap. You use multimap when the data is coming from different source documents, not when the conditions are different. What you need is a single map statement that has your conditional logic inline.

    Map = products =>
      from product in products
      select new {
        product.ClientName, 
        NumberProducts = 1,
        NumberProductsWithCondition = product.TestResults.Condition == true ? 1 : 0,
        NumberProductsWithoutCondition = product.TestResults.Condition == false? 0 : 1,
        NumberProductsConditionTestInconclusive = product.TestResults.Condition == null ? 1 : 0
      };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put

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.