using System; using System.Collections.Generic; using System.Linq; using System.Text; using Raven.Client.Document; namespace RavenDynamicTest { class Program { public class Student { public string Id { get; set; } public string TopLevelProperty { get; set; } public Dictionary Attributes { get; set; } public Dictionary>> CategoryAttributes { get; set; } } static void Main(string[] args) { var store = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "SchoolDb" }; store.Initialize(); //creation using (var session = store.OpenSession()) { //now the student: var student = new Student(); //Top level Property student.TopLevelProperty = "toplevel"; //Simple attributes student.Attributes = new Dictionary(); student.Attributes["second"] = "second"; //CategoryAttributes student.CategoryAttributes = new Dictionary>>(); student.CategoryAttributes["EducationHistory"] = new List>(); var dict = new Dictionary(); dict["StartYear"] = "2009"; student.CategoryAttributes["EducationHistory"].Add(dict); session.Store(student); session.SaveChanges(); } using (var session = store.OpenSession()) { var test = (from student in session.Query() where student.CategoryAttributes["EducationHistory"].Any(edu => edu["StartYear"] == "2009") select student).ToList(); } } } }