데이터베이스
-
여러 뎁스의 reference 에 대하여 populate 하기데이터베이스 2024. 5. 16. 13:03
https://mongoosejs.com/docs/populate.html= 3.2. Mongoose has a more powerful alternative called populate(), which lets you reference documents in other collections. Population is the process of automatically replacing th" data-og-host="mongoosejs.com" data-og-source-url="https://mongoosejs.com/docs/populate.html" data-og-url="https://mongoosejs.com/docs/populate.html" data-og-image="https://scra..
-
업데이트 추가문제 해답데이터베이스 2024. 4. 24. 13:08
연습과제 7 db.movies.updateMany({}, [ { $set: { info: ["$year", "$rating", "$runtime"] }} ])연습과제 8db.movies.updateMany({}, { $unset: { mpa_rating: 1 } })연습과제 9db.movies.updateOne({ id: 61230 }, { $set: { "torrents.1.url": "url 수정함" }})연습과제 10db.movies.updateMany({}, [ { $set: { "torrents.seeds": "$runtime", "torrents.peers": "$year" } }] )연습과제 11db.movies.updateMany({ runtime: { $mod: ..
-
몽고 DB 쿼리 - 연습과제데이터베이스 2024. 4. 23. 14:43
연습과제 1 db.movies.find({ title: { $regex: /er/ }}).count() 연습과제 2 db.movies.find( { year: { $gt: 2020 }}).count() 연습과제 3 db.movies.find({ year: { $gte: 2005, $lte: 2007 }}).count() 연습과제 4 db.movies.find({ genres: { $in: ["Comedy", "Horror"] }}).count() 연습과제 5 db.movies.find({ runtime: { $mod: [5, 0] }}).count() 연습과제 6 db.movies.find({ $and: [{ rating: { $gt: 7 } }, { year: { $gt: 2020 } }] }).cou..
-
0. 몽고DB - 설치 가이드 (최신)데이터베이스/MongoDB 수업 2024. 4. 3. 11:08
https://www.mongodb.com/try/download/community Try MongoDB Community Edition Try MongoDB Community Edition on premise non-relational database including the Community Server and Community Kubernetes Operator for your next big project! www.mongodb.com https://kitty-geno.tistory.com/155 MongoDB | 윈도우 MongoDB 설치하기 MongoDB 몽고 DB는 크로스 플랫폼 도큐먼트 지향 데이터베이스 시스템이다. NoSQL 데이터베이스로 분류되며 JSON과 같은 동적 스키마형 도큐먼트들..
-
MongoDB Aggregation 연습을 위한 users, todo 컬렉션 데이터데이터베이스 2023. 8. 9. 00:58
[{ "_id": { "$oid": "64ce25e477f3990862da1aa1" }, "name": "태양", "email": "sun@gmail.com", "userId": "sunrise", "password": "1234567890", "isAdmin": true, "createdAt": { "$date": "2023-08-05T10:35:16.554Z" }, "lastModifiedAt": { "$date": "2023-08-05T10:35:16.554Z" }, "__v": 0 },{ "_id": { "$oid": "64cf707520b5c16d5cb034f1" }, "name": "홍길동", "email": "gildong@gmail.com", "userId": "gildong", "pass..
-
3. 몽고 DB - aggregation (집계, 합산)데이터베이스/MongoDB 수업 2023. 8. 2. 17:35
https://ozofweird.tistory.com/entry/MongoDB-Aggregation-Pipeline [MongoDB] Aggregation Pipeline 1. Aggregation Pipeline 1) Pipeline 파이프라인이란, 이전 단계의 연산결과를 다음 단계 연산에 이용하는 것을 의미한다. 2) Aggregation Framework MongoDB의 Aggregation Framework는 데이터 처리 파이프라인의 개념을 ozofweird.tistory.com * match 파이프라인 실습 [ { "author" : "dave", "score" : 80, "views" : 100 }, { "author" : "dave", "score" : 85, "views" : 521 }, ..
-
Mongo DB 설치 및 데이터 CRUD (생성, 조회, 변경, 삭제) 해답데이터베이스/MongoDB 연습과제 해답 2022. 3. 29. 19:32
* 연습과제 1 db.inventory.updateMany({status: "D"}, [{$set: { "status" : ["$size.h", "$size.w"] }}]) 달러($)와 점(.)는 size 도큐먼트의 프로퍼티 값을 조회한다. $를 사용하려면 반드시 {$set: } 부분을 배열([])로 감싸줘야 한다. * 연습과제 2 db.inventory.updateMany({status: "A", qty: {$lt: 50}}, { $set: { "size.h" : "big" } }) * 연습과제 3 db.inventory.updateOne({qty: 100}, {$set: {item: "아이템"}}) * 연습과제 4 db.inventory.updateMany({}, {$set: {users: ["vic..
-
Mongo DB 배열(Array) 쿼리(Query) 연습 해답데이터베이스/MongoDB 연습과제 해답 2022. 1. 20. 22:12
* 연습과제 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 배열의 첫번째 요소..