728x90

MongoDB 4

Mongo DB 배열(Array) 쿼리(Query) 연습 해답

* 연습과제 1 해답 1 - 이름으로 검색 db.inventory.find({item:"postcard"}) 해답 2 - 다수의 조건을 동시에 만족하는 배열요소를 하나 이상 포함하고 있는 도큐먼트 검색 db.inventory.find({dim_cm:{$elemMatch:{$gt:15, $lt:16}}}) 해답 3 - 배열 인덱스에서 특정 조건을 만족하고 있는 쿼리 검색 db.inventory.find({"dim_cm.1":{$lt:16}}) // dim_cm 배열의 두번째 요소 값 기준 db.inventory.find({"dim_cm.0":{$lt:11}}) // dim_cm 배열의 첫번째 요소 값 기준 db.inventory.find({"tags.0": "blue"}) // tags 배열의 첫번째 요소..

1. 몽고 DB - 데이터 CRUD (생성, 조회, 변경, 삭제)

* 에러 기록 MongoServerError: E11000 duplicate key error collection: thona.products index: _id_ dup key: { _id: 100 }블로그 글에 따라 몽고 DB 를 연습하다가 위와 같은 오류가 나면 해당 DB (thona) 를 삭제하고, 다시 DB 를 생성하고 컬렉션을 추가하고 진행하면 된다.  * Mongo DB 설치 몽고DB 설치 가이드 - 최신  몽고DB 설치 가이드 - 최신https://www.mongodb.com/try/download/community Try MongoDB Community Edition Try MongoDB Community Edition on premise non-relational ..

728x90