daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Dec 9th, 2018 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Schema Layout:
  2. const mongoose = require("mongoose");
  3.  
  4. module.exports = function(db) {
  5.  
  6. let gameSchema = new mongoose.Schema({
  7.  
  8. opponent: String,
  9. location: String,
  10. date: String,
  11. completions: Number,
  12. attempts: Number,
  13. yards: Number,
  14. touchdowns: Number,
  15. interceptions: Number,
  16. });
  17.  
  18. let quarterbackSchema = new mongoose.Schema({
  19. firstName: String,
  20. lastName: String,
  21. school: String,
  22. age: Number,
  23. hometown: String,
  24. games:[gameSchema]
  25. });
  26.    
  27. {
  28. "_id": {
  29.     "$oid": "5c0a551df8555c1c1ef0c101"
  30. },
  31. "firstName": "Pepper",
  32. "lastName": "Princess ",
  33. "age": 14,
  34. "hometown": "Farmville, Ms",
  35. "school": "Farmers School of Important Stuff",
  36. "games": [
  37.     {
  38.         "_id": {
  39.             "$oid": "5c0ca5ba7213fe6a5f52848c"
  40.         },
  41.         "opponent": "Crock McSnagglebite",
  42.         "location": "Pattys Putrid Flower Garden",
  43.         "date": "1/23/2020",
  44.         "completions": 777,
  45.         "attempts": 777,
  46.         "yards": 777,
  47.         "touchdowns": 777,
  48.         "interceptions": 777
  49.     }
  50. ],
  51. "__v": 1
  52. }
  53.    
  54. Quarterback.find({_id: req.body.id}).then(function(Results){});
  55.  
  56.  Quarterback.findOne({_id: req.body.id}).then(ect...
  57.  
  58.  Quarterback.findById({_id: req.body.id}).then(ect...
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top