Advertisement
Guest User

Untitled

a guest
Sep 15th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. {$push: {
  2. "progress.$.exercise":{
  3. "exercise":exercise
  4. }
  5. }
  6.  
  7. {$push: {
  8. "progress.$.exercise.$.workout":{
  9. "_set":_set,
  10. "reps":reps,
  11. "weight":weight
  12. }
  13. }
  14.  
  15. var Workout = new mongoose.Schema({
  16. _set : {
  17. type: String
  18. },
  19. reps: {
  20. type: String
  21. },
  22. weight: {
  23. type: String
  24. }
  25. });
  26.  
  27.  
  28. var Exercise = new mongoose.Schema({
  29. exerciseName : {
  30. type: String
  31. },
  32. workout : [Workout]
  33. });
  34.  
  35.  
  36. var Progress = new mongoose.Schema({
  37. date : {
  38. type: String
  39. },
  40. name : {
  41. type: String
  42. },
  43. exercise : [Exercise]
  44. });
  45.  
  46.  
  47. var UserSchema = mongoose.Schema({
  48. username: {
  49. type: String,
  50. index:true
  51. },
  52. password: {
  53. type: String
  54. },
  55. email: {
  56. type: String
  57. },
  58. name: {
  59. type: String
  60. },
  61. progress : [Progress]
  62.  
  63. });
  64.  
  65.  
  66. var User = module.exports = mongoose.model('User', UserSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement