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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:50:23+00:00 2026-05-24T18:50:23+00:00

This question regards querying nested dictionaries. I have a case which can be simplified

  • 0

This question regards querying nested dictionaries.

I have a case which can be simplified into the following setup with a style containing a list of SKUs containing a list of Collis.

CLASS DEFINITIONS:

public class Style
{
    public string Name { get; set; }
    public Dictionary<string, Sku> Skus = new Dictionary<string, Sku>();
}
public class Sku
{
    public string Name { get; set; }
    public Dictionary<string, Colli> Collis = new Dictionary<string, Colli>();
}
public class Colli
{
    public string Name { get; set; }
}

JSON DATA IN RAVEN DB:

{
 "Skus": {
    "Sku1": {
      "Collis": {
        "Right": {
          "Name": "Right"
        },
        "Right again": {
          "Name": "Right again"
        },
        "Wrong": {
          "Name": "Wrong"
        }
      },
      "Name": "Sku1"
    },
    "Sku2": {
      "Collis": {
        "Wrong 1": {
          "Name": "Wrong 1"
        },
        "Wrong 2": {
          "Name": "Wrong 2"
        },
        "Wrong 3": {
          "Name": "Wrong 3"
        }
      },
      "Name": "Sku2"
    }
  },
  "Name": "Style1"
}

VALID QUERIES:

(Ask for style with skus of specific names)

var existingStyleWithSku1 = session.Query<Style>().Where(s => s.Skus["Sku1"] != null).ToList();
var nonexistingStyleWithSku4 = session.Query<Style>().Where(s => s.Skus["Sku4"] != null).ToList();

INVALID NESTED QUERY

(Ask for style containing a sku named “Sku1” that contains a colli named “Right”)

var styleWithSpecificColli = session.Query<Style>().Where(s => s.Skus["Sku1"].Collis["Right"] != null).ToList();

When i attempt to execute the last query, I get the message:

{ “Url”:
“/indexes/dynamic/Styles?query=-Skus.get_Item(%2522Sku1%2522).Collis.Right%253A%255B%255BNULL_VALUE%255D%255D%2520AND%2520Skus.get_Item(%2522Sku1%2522).Collis.Right%253A*&start=0&pageSize=128&aggregation=None”,
“Error”: “System.ArgumentException: The field ‘)CollisRight’ is not
indexed, cannot query on fields that are not indexed\r\n at
Raven.Database.Indexing.Index.IndexQueryOperation.AssertQueryDoesNotContainFieldsThatAreNotIndexes()
in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 628\r\n
at
Raven.Database.Indexing.Index.IndexQueryOperation.d__1c.MoveNext()
in c:\Builds\raven\Raven.Database\Indexing\Index.cs:line 542\r\n
at
System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n
at
System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()\r\n
at System.Collections.Generic.List1.InsertRange(Int32 index,
IEnumerable
1 collection)\r\n at
……..

Is there a way that I can be able to execute the last query? Maybe defining what to index in RavenDB?

Thankyou 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-05-24T18:50:24+00:00Added an answer on May 24, 2026 at 6:50 pm

    I posted the example above as failing test, but synhershko corrected my code in order to make it work.

    It is actually possible to do this. The query just looks like this instead:

    WRONG:

    var styleWithSpecificColli = session.Query<Style>()
    .Where(s => s.Skus["Sku1"].Collis["Right"] != null)
    .ToList();
    

    RIGHT:

    var styleWithSpecificColli = session.Query<Style>()
     .Select(s => s.Skus["Sku1"])
     .Where(c => c.Collis["Right"] != null)
     .ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just asked this question an hour ago but with regards to IE8
I bumped into an additional question that I needed in regards to this: Using
In regards to the answer for this question Passing DataContext into Action() , how
This question regards how one can effectively create and persist event domain objects on
This question regards my personal photography website. I use the following javascript to generate
I understand this question can be general but, specifically with regards to ASP.NET MVC,
First of all, this question is in regards to PHP and MySQL I have
In regards to my this question , I got this following answer to add
This question is in regards to this blog entry. https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/ All the way at
I had posted a question in regards to this code. I found that JTextArea

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.