Skip to content

Create One on One Relationship MongoDB with NodeJS and Mongoose.

Notifications You must be signed in to change notification settings

sanengineer/nodejs-mongoose-1on1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create One To One Relationship MongoDB With NodeJS and Mongoose

ER Diagram One to One Relationship MongoDB with Mongoose and NodeJS

Data Base Input

Change value of key database on server.js

Example:

For Brand Table :
{
    name: "Microsoft"
}

For Device Table :

{
    name: "Surface Book"
    storage: "256GB"
    color: "Grey"
    code: 512GB // key code is automatically generated
    brand: {name: "Microsoft"} // automatically by reference on Brand Table
}

So you just change key name on Brand table, and change keys name, storage, color on Device table.

Run Code

$ cd
$ npm run dev