개발/Javascript

MongoDB start

등반 2022. 8. 27. 21:59

collection : document들의 집합

mongoDB에서 최소의 정보단위 = document

 

    const users = client.db('db22').collection('users')
 
이미 만들어져있는 컬렉션이 아니라도, 컬렉션을 지정하면 만들 수가 있어요~
 
 
await users.deleteMany({}) : users컬렉션 비우기
await users.insertMand([...])

const cursor = users.find({})

await cursor.forEach(console.log)

 

 

 

참고 : https://www.mongodb.com/docs/drivers/

'개발 > Javascript' 카테고리의 다른 글

router.post() / redirect  (0) 2022.08.15
supertest, jest  (0) 2022.08.15