title: MongoDB Deeply Nested
body: <p>I have some difficulties with deeply nested arrays within MongoDB. I am using mongoose and my project consists of micro-services that all currently use the same database collection. Is it possible to use the below example with how deeply nested it is? If so, how would one access the <code>"questionUser"</code> , <code>"questionTitle"</code>, or <code>"questionContent"</code>. I currently am able to add course and lesson titles. when I am trying to add question data the correct router is getting hit, but it just hangs and times out and all the data going through is <code>null</code>.</p>
  
  <p>I have condensed the data example below. I am working with MEAN stack. I also am not seeing any errors, it is just hanging. Not sure where or how to start troubleshooting this. I am not against redesigning my DB, but would like to keep with nested/embedded structure somehow but would need a little guidance on how I might look to change it.</p>
  
  <p><strong>Database</strong></p>
  
  <pre><code>{
   "_id": "593bc9fbbc083a8200eb9b36",
    "courseTitle": "Course 101",
    "courseActive": true,
    "lessons": [
      {
        "lessonTitle": "Lesson about widgets",
        "_id": "593bcecc0799cd89a87ce53e",
        "lessonActive": true,
        "questions": [
          {
              "questionUser": "user1",
              "_id" : "dadsfjlkj23o21",
              "questionTitle": "title",
              "questionContent": "stuffff",
              "answers" : [
                  {
                      "answerUser": "user2",
                      "_id": "asdfk231191837d",
                      "answerContent": "the answer is simple",
                      "comment": [
                          {
                              "commentUser": "user1",
                              "_id": "asdkjfawow8183",
                              "commentBody": "That makes sense, thanks!"
                          }
                          ]
                  }
                  ]
          }
          ]
      }
    ]
  }
  </code></pre>
  
  <p><strong>Routers</strong></p>
  
  <pre><code>/*
   * create new course
   */
  router.post('/', (req, res) =&gt; {
    let course = new Course();
    course.courseTitle = req.body.courseTitle;
    course.courseActive = req.body.courseActive;
    course.save().then((saveCourse) =&gt; res.json(saveCourse))
      .catch((err) =&gt; console.log(err));
  });
  
  /*
   * create new lesson
   */
  router.post('/:id', (req, res) =&gt; {
    Course.findOne({_id: req.params.id}).then((foundCourse) =&gt; {
      foundCourse.lessons = req.body.lessons;
      foundCourse.save().then((savedCourse) =&gt; res.json(savedCourse))
        .catch((err) =&gt; console.log(err));
    })
  });
  
  /*
   * create new question
   */
   router.post('/:id/lessons/:lessonid', (req, res) =&gt; {
     Lesson.findOne({_id: req.params.id}).then((foundLesson) =&gt; {
       foundLesson.questions = req.body.questions;
       foundLesson.save().then((savedLesson) =&gt; res.json(savedLesson))
         .catch((err) =&gt; console.log(err));
     })
   });
  </code></pre>
  
  <p><strong>app.ts</strong></p>
  
  <pre><code>import courses from './api/courses';
  app.use('/api/v2/courses', courses);
  
  import lessons from './api/lessons';
  app.use('/api/v2/lessons', lessons);
  
  import questions from './api/questions';
  app.use('/api/v2/questions', questions);
  </code></pre>