title: Mongoid and Mongodb querying
body: <p>I have a data strcuture like this</p>
  
  <pre><code>Courses
  {
      "name" : "Course1",
      "student_id"
      "subjects" :
      [{
        "level" : "1",
        "short_name" : "Maths",
        "topics" : [{
                "name" : "Algebra 101",
                "week" : "1",
                "submission_week" : ISODate("2013-07-28T00:00:00Z"),
                "correction_week" : ISODate("2013-07-28T00:00:00Z")
                },
                {
                "name" : "Algebra 201",
                "week" : "1",
                "submission_week" : ISODate("2013-07-28T00:00:00Z"),
                "correction_week" : ISODate("2013-07-28T00:00:00Z")
                }
       ]},
       {
        "level" : "2",
        "short_name" : "Chem"
       }
      ]
  }
  </code></pre>
  
  <p>Using Mongoid I am trying to retrieve all topics.</p>
  
  <p>I have tried all sorts of queries but cannot seem get it.</p>
  
  <p>e.g I don't understand why this doesn't work?</p>
  
  <pre><code>Topic.where( name: "Algebra 101", 'subject.short_name' =&gt;"Maths", 'subject.course.name' =&gt;"Course1")
  </code></pre>
  
  <p>Can I query like this?</p>
  
  <p>My ruby code is</p>
  
  <pre><code>class Course
    embeds_many :subjects
  
  class Subject
    embedded_in :course
    embeds_many :topics
  
  class Topic
    embedded_in :subject
  </code></pre>