๐Ÿ˜Ž ๊ณต๋ถ€ํ•˜๋Š” ์ง•์ง•์•ŒํŒŒ์นด๋Š” ์ฒ˜์Œ์ด์ง€?

[FuncAnimation] 4. Mongo DB์— ์‹œ๊ณ„์—ด ๋ฐ์ดํ„ฐ ์ €์žฅํ•˜๊ธฐ (2) ๋ณธ๋ฌธ

๐Ÿ‘ฉ‍๐Ÿ’ป ์ธ๊ณต์ง€๋Šฅ (ML & DL)/Serial Data

[FuncAnimation] 4. Mongo DB์— ์‹œ๊ณ„์—ด ๋ฐ์ดํ„ฐ ์ €์žฅํ•˜๊ธฐ (2)

์ง•์ง•์•ŒํŒŒ์นด 2022. 10. 25. 11:19
728x90
๋ฐ˜์‘ํ˜•

221025 ์ž‘์„ฑ

<๋ณธ ๋ธ”๋กœ๊ทธ๋Š” 3dpit ๋‹˜์˜ ๋ธ”๋กœ๊ทธ๋ฅผ ์ฐธ๊ณ ํ•ด์„œ ๊ณต๋ถ€ํ•˜๋ฉฐ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค>

https://3dpit.tistory.com/398?category=819929 

 

WEB ๋งŒ๋“ค๊ธฐ - 0 ๋ฆฌ์•กํŠธ ์ดˆ๊ธฐ ์„ค์ •

vs code ๋‹ค์šด๋กœ๋“œํ•˜๊ธฐ code.visualstudio.com/ Visual Studio Code - Code Editing. Redefined Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud a..

3dpit.tistory.com

 

 

๐Ÿฅฉ DB ๋„ฃ๊ธฐ ์„ฑ๊ณต

# 8. MongoDB ์ €์žฅํ•˜๊ธฐ
data_dict = load_file()
data_dict = pd.DataFrame(data_dict)
data_dict = data_dict.to_dict("records")
# print(data_dict)
#data_dict = data_dict.to_dict("records")         # ๋ฐ์ดํ„ฐ๋ฅผ ์‚ฌ์ „ํ˜•์œผ๋กœ

client = MongoClient("mongodb+srv://gani:hilee5868@cluster0.h7jyl5v.mongodb.net/?retryWrites=true&w=majority")

db = client.queinfo_20220929

doc = {'name':'jk','age':26}
db.cnt_item.insert_many(data_dict)

 

 

 

๐Ÿฅฉ MongoDB์— ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์›นํŽ˜์ด์ง€์— ์ถœ๋ ฅํ•˜๊ธฐ

1. React, node.js ๋“ฑ ํŒจํ‚ค์ง€ ๊น”๊ธฐ ( ๋ฐ‘ ์ฃผ์†Œ๋ฅผ ๋™์ผํ•˜๊ฒŒ ๋”ฐ๋ผํ•˜๊ธฐ )

https://3dpit.tistory.com/398?category=819929 

 

2. ์„ค์น˜ ํ™•์ธํ•˜๊ธฐ

  "scripts": {
    "start" : "node index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  • http://localhost:3000

 

3. ์œ ์ €๋ชจ๋ธ & ์Šคํ‚ค๋งˆ ์ƒ์„ฑ

- ๋ชจ๋ธ : ์Šคํ‚ค๋งˆ๋ฅผ ๊ฐ์‹ธ๋Š” ์—ญํ• 

- ์Šคํ‚ค๋งˆ : ํ•˜๋‚˜ ํ•˜๋‚˜์˜ ์ •๋ณด๋ฅผ ์ง€์ •ํ•ด์ฃผ๋Š” ๊ฒƒ

const mongoose = require("mongoose");
const userSchema = mongoose.Schema({
    name : {
        type : String,
        maxlength : 50
    },
    email : {
        type : String,
        trim : true,
        unique : 1
    },
    password : {
        type : String,
        minlength : 5
    },
    lastname : {
        type : String,
        maxlength : 50
    },
    role : {
        type : Number,
        default : 0
    },
    image : String,
    token : {
        type : toString,
    },
    tokenExp : {
        type : Number
    },
})

const User = mongoose.model("User", userSchema)
module.exports = {User};        // ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด
const User = mongoose.model("User", userSchema)
module.exports = {Product};     // ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ๋ณด๋‚ด๊ธฐ ์œ„ํ•ด

 

4. Git ์„ค์น˜

: ๋ถ„์‚ฐ ๊ด€๋ฆฌ ์ œ์–ด ์‹œ์Šคํ…œ

  • .gitignore ํŒŒ์ผ ๋งŒ๋“ค๊ธฐ
node_modules
  • Git add & commit

 

5. Github ์—ฐ๊ฒฐ

  • ์ƒˆ๋กœ์šด Repository ๋งŒ๋“ค๊ธฐ

  • ์•ˆ์ „ํ•˜๊ฒŒ ํ†ต์‹ ํ•˜๊ธฐ ์œ„ํ•ด SSH ๋ผ๋Š” Secure Shell ์ด์šฉ

 

  • SSH Agent ํ™”๋ฉด์— ์ผœ๊ธฐ
eval `ssh-agent -s`

 

  • GitHub์— ์—ฐ๊ฒฐํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ ํ•˜๋ ค๋Š” ๊ธฐ์กด ๊ณต๊ฐœ ๋ฐ ๊ฐœ์ธ ํ‚ค ์Œ(์˜ˆ: id_rsa.pub ๋ฐ id_rsa )์ด ๋‚˜์—ด๋˜๋ฉด ssh-agent์— ํ‚ค๋ฅผ ์ถ”๊ฐ€
ssh-add ~/.ssh/id_ed25519

 

  • github์— SSH ํ‚ค ์ถ”๊ฐ€ํ•˜๊ธฐ
    • .ssh ์—์„œ ๋ณต๋ถ™ํ•ด์„œ ๋ถ™์—ฌ๋„ฃ๊ธฐ

 

  • git remote ํ•˜๊ธฐ
    • ๋ฐ‘์— push ์–ด์ฉŒ๊ณ ๋งŒ ํ•จ

 

728x90
๋ฐ˜์‘ํ˜•
Comments