몽고DB 회원가입
https://account.mongodb.com/account/register
pymongo기본 코드
from pymongo import MongoClient
client = MongoClient('여기에 URL 입력')
db = client.dbsparta
from pymongo import MongoClient
client = MongoClient('mongodb+srv://son-gyeong-ah:Rhddk114@cluster0.jduknc6.mongodb.net/cluster0?retryWrites=true&w=majority')
db = client.dbsparta
doc = {
'name' : 'bob',
'age':27
}
doc = {'name': 'bobby','age':27}
db.users.insert_one(doc)
작성한 내용이 몽고DB에 들어간다.
doc = {'name':'bobby','age':21}
db.users.insert_one(doc)
user = db.users.find_one({'name':'bobby'})
all_users = list(db.users.find({},{'_id':False}))
db.users.update_one({'name':'bobby'},{'$set':{'age':19}})
db.users.delete_one({'name':'bobby'})