본문 바로가기
[K8s] bash kubectl 자동완성 편의 기능# ubuntusudo apt install bash-completion# centossudo yum install -y bash-completion# 공통echo "source > ~/.bashrcecho 'alias k=kubectl' >>~/.bashrcecho 'complete -o default -F __start_kubectl k' >>~/.bashrcsource ~/.bashrc 2025. 6. 18.
[K8s] 쿠버네티스 표준 생태계 오픈소스 2025. 6. 17.
[MongoDB] Aggregation Pipeline 동작 방식 MongoDB 어그리게이션 파이프라인의 핵심 동작 방식은 무엇인가요?순차적 처리입니다. 파이프라인의 각 단계는 이전 단계의 결과를 입력받아 순서대로 실행됩니다. 이 순서는 매우 중요 $match$match는 파이프라인 초반에 사용하여 데이터 양을 줄이는 데 효과적입니다. SQL의 WHERE와 유사한 역할 $group$group 연산자는 지정된 키로 문서를 그룹화하고, $sum, $avg 등의 표현식을 사용해 집계를 수행 $lookup$lookup은 다른 컬렉션에서 일치하는 문서를 가져와 연결합니다. 보통 $unwind와 함께 사용되어 조인 결과를 처리 $project$project는 특정 필드를 include, exclude하는 역할 2025. 6. 17.
[MongoDB] 실전 쿼리 작성2 [ // 특정 필드만 include, exclude {$project: { title : 1, _id : 0 // _id는 자동 생성되는데 쓰고 싶지 않으면 0으로 추가 }}, // 특정 필드만 include, exclude // 유지보수 가독성이 떨어짐. 좋은 형태는 아님 (프로시저 유사) // 쿼리를 가져와서 클라이언트 레벨에서 처리하는 것이 좋음 {$project: { title : 1, year : 1, genres : 1, first_genre :{$arrayElemAt : ["$genres", 0]}, imdb : 1, imdb_score : { $cond : [ // 특정 값이 크다면 Excel.. 2025. 6. 17.
[MongoDB] 실전 쿼리 작성 데이터 샘플{ "_id": { "$oid": "573a1399f29313caabcee864" }, "plot": "A serial adventure writer with problems in his personal life lives out the adventures of his literary hero, King of Adventurers.", "genres": [ "Action", "Adventure" ], "runtime": 91, "cast": [ "Jet Li", "Rosamund Kwan", "Charlie Yeung", "Takeshi Kaneshiro" ], "num_mflix_comments": 0, "poster": "https:/.. 2025. 6. 16.
[MongoDB] 데이터 파이프라인과 Lookup 집계 함수GROUP BY, SUM , AVG, COUNT$group, $sum, $avg, $count-------$lookup$matchSELECT, AS$project, $addFields, $set------[ {$match : {status : "A"}}, {$group : {"_id" : "$cust_id", total : {$sum : "$amount"}}, {$sort : {"total" : -1}]{ "cust_id" : "A", "amount" : 3}{ "cust_id" : "B", "amount" : 10}{ "cust_id" : "A", "amount" : 3}{ "_id" : "A", "total" : 6}{ "_id.. 2025. 6. 16.