Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Schema Layout:
- const mongoose = require("mongoose");
- module.exports = function(db) {
- let gameSchema = new mongoose.Schema({
- opponent: String,
- location: String,
- date: String,
- completions: Number,
- attempts: Number,
- yards: Number,
- touchdowns: Number,
- interceptions: Number,
- });
- let quarterbackSchema = new mongoose.Schema({
- firstName: String,
- lastName: String,
- school: String,
- age: Number,
- hometown: String,
- games:[gameSchema]
- });
- {
- "_id": {
- "$oid": "5c0a551df8555c1c1ef0c101"
- },
- "firstName": "Pepper",
- "lastName": "Princess ",
- "age": 14,
- "hometown": "Farmville, Ms",
- "school": "Farmers School of Important Stuff",
- "games": [
- {
- "_id": {
- "$oid": "5c0ca5ba7213fe6a5f52848c"
- },
- "opponent": "Crock McSnagglebite",
- "location": "Pattys Putrid Flower Garden",
- "date": "1/23/2020",
- "completions": 777,
- "attempts": 777,
- "yards": 777,
- "touchdowns": 777,
- "interceptions": 777
- }
- ],
- "__v": 1
- }
- Quarterback.find({_id: req.body.id}).then(function(Results){});
- Quarterback.findOne({_id: req.body.id}).then(ect...
- Quarterback.findById({_id: req.body.id}).then(ect...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement