Mongodb compass ~ connection

mongodb+srv://hajun:<password>@nestcluster.6afp4lo.mongodb.net/test

스크린샷 2022-12-25 오후 11.04.35.png

mongodb+srv://hajun:<password>@nestcluster.6afp4lo.mongodb.net 를 입력하여 mongodb compass의 connection을 연결할 수 있다.

CRUD

use ye
'switched to db ye'

## create
db.users .insertOne({name:"amamov", <email:"[email protected]>"})
{ acknowledged: true,
  insertedId: ObjectId("63a85991880235c4a3d594e3") }

## read
db.users.find()
{ _id: ObjectId("63a85991880235c4a3d594e3"),
  name: 'amamov',
  email: '[email protected]' }

## update
db.users .updateOne({_id : ObjectId("63a85991880235c4a3d594e3") }, {$set: {name:"ssss"}})
{ acknowledged: true,
  insertedId: null,
  matchedCount: 1,
  modifiedCount: 1,
  upsertedCount: 0 }

## delete
db.users.deleteOne({_id : ObjectId("63a85991880235c4a3d594e3")})
{ acknowledged: true, deletedCount: 1 }