title: node js mongoose find by deeply nested documents
body: <p>In Node js mongoose Need to search the article description in following schema levels. how can it be possible with mongoose.
  I have tried using $elemMatch and its not working. schema level is as follows.</p>
  
  <pre><code>var articleSchema = new Schema({
      name: { type: String, required: true },
      displayName: { type: String },
      description: { type: String },
  
  });
  
  mongoose.model('Article', articleSchema);   
  
  var subChapterSchema = new Schema({
      name: {type: String, required: true},
      displayName: {type: String},
      Articles:[articleSchema],
  
  
  });
  
  mongoose.model('SubChapter', subChapterSchema); 
  
  var chapterSchema = new Schema({
      name: {type: String, required: true },
      displayName: {type: String },
      subChapters: [subChapterSchema],
  
  });
  
  mongoose.model('Chapter', chapterSchema);
  
  var agreementSchema = new Schema({
      name: {type: String, required: true },
      displayName: {type: String },
      Chapters: [chapterSchema],
  
  });
  
  mongoose.model('Agreement', agreementSchema);
  </code></pre>
  
  <p>I have tried as follows.but its not working.</p>
  
  <pre><code>var regex = new RegExp(text, "i");
  
      var criteria = { 
      Chapters.subChapters.Articles : {
                                                      $elemMatch: {
                                                          description:regex
                                                      }
                                                    }
                                          }
  
  Agreement.find({criteria},'name displayName',function(err,docs){
          if (err)
              console.log('error occured in the database');
          console.log(docs);
      }); 
  </code></pre>