728x90
Comparison With Relational Database
Relational DB : SQL
Create two different tables and tangle them with SQL.
MongoDB : No-SQL
Create two different objects and nest.
const mongoose = require('mongoose')
const Schema = mongoose.Schema
const BookSchema = new Schema({
title: String,
pages: Number
})
const AuthorScheam = new Schema({
name: String,
age: Number,
book: [BookSchema] // nested
})
// mongoose.model(model name, model schema)
const Author = mongoose.model('Author', AuthorSchema)
module.exports = Author
728x90
'창고 3 > [Dev] My Readme' 카테고리의 다른 글
Node js 기초 2 (0) | 2022.01.13 |
---|---|
Node js 기초 1 (0) | 2022.01.12 |
몽고 DB 기초 5 (0) | 2022.01.10 |
몽고 DB 기초 4 (0) | 2022.01.07 |
몽고 DB 기초 3 (0) | 2022.01.06 |
댓글