title: How can I restructure my database?
body: <p>I have a collection with embedded documents. This worked fine when updating a document within a document, but when I had to update a document within a document within a document problems arose. To make this work I would need to use a double '$' and this is not possible. 
  This works:</p>
  
  <pre><code>{$push: {
          "progress.$.exercise":{
              "exercise":exercise
          }
  }
  </code></pre>
  
  <p>This is where the problem comes in:</p>
  
  <pre><code>{$push: {
          "progress.$.exercise.$.workout":{
              "_set":_set, 
              "reps":reps,
              "weight":weight
          }
      }
  </code></pre>
  
  <p>Since dobbel $ can't be done and there seems to be no way (that I can find) to do it with elemMatch. I can only come to the conclusion that the way I have structured my Database is wrong.... </p>
  
  <p>Here are my Schemas:</p>
  
  <pre><code>var Workout = new mongoose.Schema({
      _set : {
          type: String
      },
      reps: {
          type: String
      },
      weight: {
          type: String
      }
  });
  
  
  var Exercise = new mongoose.Schema({
      exerciseName : {
          type: String
      },
      workout : [Workout]
  });
  
  
  var Progress = new mongoose.Schema({
      date : {
          type: String
      },
      name : {
          type: String
      },
      exercise : [Exercise]
  });
  
  
  var UserSchema = mongoose.Schema({
      username: {
          type: String,
          index:true
      },
      password: {
          type: String
      },
      email: {
          type: String
      },
      name: {
          type: String
      },
      progress : [Progress]
  
  });
  
  
  var User = module.exports = mongoose.model('User', UserSchema);
  </code></pre>
  
  <p>It seems I need to restructure my database, if so how should I do this? 
  Do I need to make more collections? 
  I'm used to relational databases and if I where to make collections out of all of them it would start to look like that. </p>