title: Find and delete document inside nested array
body: <p>I am struggling to delete element inside nested arrray in mongoDB.</p>
  
  <p>Lets say I have this schema:</p>
  
  <pre><code>var question = new Schema({
    problem: {
      type: String,
      required: true
    },
    multipleChoices: [{
      type: String,
      required: true
    }],
    correctAnswer: {
      type: Number,
      required: true
    }
  });
  
  var testCategorySchema = new Schema({
    category: {
      type: String,
      required: true
    },
    tests: [{
      version: {
        type: String,
        required: true
      },
      questions: [question]
    }]
  });
  </code></pre>
  
  <p>For example I have instance of that schema like this:</p>
  
  <pre><code>{
    category: "Math",
    tests: [
      {
        _id : ObjectId("580859310a0d4b40ac1c6034"),
        version: "1A",
        questions: [
           {
             problem: "blablabla",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ],
             correctAnswer: 1
           },
           {
             problem: "blibliblibli",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ]
             correctAnswer: 1
           }
        ]
      },
      {
        _id : ObjectId("580859310a0d4r40ax1c5034"),
        version: "1B",
        questions: [
           {
             problem: "auauauauau",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ]
             correctAnswer: 1
           },
           {
             problem: "blibliblibli",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ]
             correctAnswer: 1
           }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>For example, how can I delete problem: "blablabla" in category math and version 1A using mongooseJS?</p>
  
  <p>I already to delete problem in math category and version 1A using this code:</p>
  
  <pre><code>TestCategory
      .findOne(
        {
          category: req.params.testCategory,
          'tests.version': req.params.testVersion
        },
        {
          'tests.version.$': 1
        }
      )
      .then(function(testVersion) {
        res.send(testVersion);
      })
      .catch(function(err) {
        console.log(err);
        next(err);
      });
  </code></pre>
  
  <p>For example I search math category and version 1A, the result from that code is like this:</p>
  
  <pre><code>_id: "580859190a0d4b40ac1c6033",
  tests: [
      {
        _id : ObjectId("580859310a0d4b40ac1c6034"),
        version: "1A",
        questions: [
           {
             problem: "blablabla",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ],
             correctAnswer: 1
           },
           {
             problem: "blibliblibli",
             multiplechoices: [
              "bla bla", "blb blb", "blc blc"
            ]
             correctAnswer: 1
           }
        ]
      }
  ]
  </code></pre>
  
  <p>The result already filtered, so only version 1A is displayed (although categoryId is still displayed). Now I am confused how to delete the question in proper and good way.</p>