Use the lesson for reference as well as the documentation.
In the lesson, we did not cover many to many associations. You will use appointments as a model to split each association into 1:N
Perhaps look at the documentation on Commentable?
| const mongoose = require('mongoose') | |
| const Schema = mongoose.Schema | |
| const myUniqueValidator = async (username) => { | |
| const doc = await User.findOne({username: username}) | |
| if (doc) { | |
| return false | |
| } else { | |
| return true | |
| } |
| const mongoose = require('mongoose') | |
| const Schema = mongoose.Schema | |
| const myValidator = (username) => { | |
| return username === "harrison" | |
| } | |
| const userSchema = new Schema({ | |
| username: { | |
| type: String, |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <div id="characters"></div> |
| const path = require('path'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| module.exports = { | |
| mode: 'development', | |
| entry: './src/App.js', | |
| output: { | |
| path: path.resolve(__dirname, 'build'), | |
| publicPath: '/', | |
| filename: 'bundle.js' |
| const express = require("express"); | |
| const morgan = require("morgan"); | |
| const expressSession = require("express-session"); | |
| const mongoose = require('mongoose'); | |
| const MongoStore = require('connect-mongo')(expressSession); | |
| const app = express(); | |
| const dbOptions = { useNewUrlParser: true, useUnifiedTopology: true } | |
| mongoose.connect("mongodb://localhost:27017/test-with-mongo-store", dbOptions, (err) => { |
| const express = require('express') | |
| const app = express(); | |
| const morgan = require('morgan'); | |
| const ObjectID = require('mongodb').ObjectID; | |
| const MongoClient = require('mongodb').MongoClient; | |
| const uri = "mongodb+srv://harrisonmalone:jHuIZ0tli^&r4quG%5RT3sWMEeoKmp@my-first-cluster-vk1sm.mongodb.net/test?retryWrites=true&w=majority"; | |
| const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); |
| # what is a block? | |
| # [1,2,3].each { |number| p number } | |
| # what is yield? | |
| # def hello | |
| # name = "harrison" | |
| # yield(5) | |
| # puts name |
| import React, { useState, useEffect } from 'react'; | |
| import axios from 'axios'; | |
| function App() { | |
| // same as setting up state | |
| const [count, setCount] = useState(0) | |
| const [pokemon, setPokemon] = useState([]) | |
| // same as componentDidMount | |
| useEffect(() => { |