DataBase (6) 썸네일형 리스트형 [TypeORM] addSelect() 결과를 Entity에 매핑하기 TypeORM은 NodeJS 환경에서 ORM 아키텍쳐를 구현할 수 있게 해주는 유용한 모듈입니다. 하지만 특정 상황에서 지원이 되지 않는 기능들이 있어서 곤란한 상황이 발생하는 경우가 많습니다. 이번에 처한 곤란한 상황은 아래와 같았습니다. const qb = this.dataSource.manager .createQueryBuilder(Users, 'u') .addSelect((qb) => qb.select('COALESCE(ROUND(AVG(ur.rate), 1), 0)').from(UserReview, 'ur'), 'userRate') .getMany(); 위와 같이 사용자의 리뷰 평점을 User 엔티티에 매핑해주고 싶은데, addSelect를 사용하면 엔티티에 매핑이 되지 않습니다. addSele.. PostgreSQL 도커로 실행하기 docker run --name postgreDb -d -p 5432:5432 -e POSTGRES_USER=test -e POSTGRES_PASSWORD=1234 postgres --name: 컨테이너 이름 -d: 컨테이너 백그라운드 실행 및 실행 후 컨테이너 아이디 출력 -p: 포트 포워딩 -e: 환경 변수 postgres: pull 받을 이미지명(tag가 없으면 자동으로 latest pull) docker exec -it CONTAINER_ID /bin/bash psql -U YOUR_USER_NAME(default: postgres) PostgreSQL 15 설치 및 연결(CentOS) 개발 환경 - OS: GCP CentOS 7 - 설치할 PostgreSQL: 15.1 1. RPM 레파지토리에 postgresql 추가 yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm yum -y repolist 2. 시스템 업데이트 yum -y update 3. 종속성 레파지토리 추가 yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 4. PostgreSQL 15 설치 yum -y install postgresql15-server psql -.. Mac에 MongoDB 설치하기 개발 환경 - M1 Macbook Pro(2021) - OS: Ventura 13.1 (22C65) 1. brew 설치 https://brew.sh/index_ko /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 2. MongoDB Homebrew Tap 추가 brew tap mongodb/brew 3. Homebrew 업데이트 brew update 4. MongoDB 설치 brew install mongodb-community@5.0 MongoDB 주요 파일 경로 1. configuration file - Intel Chip : /usr/local/etc/mongod.conf - .. MongoDB 서비스 시작 오류(exit status 14) 개발 환경 - 서버 OS: GCP VM CentOS 7 - MongoDB 버전: 5.0.14 1. 이슈 처음 MongoDB를 설치하고 서비스를 시작하면 정상적으로 동작하지만, 서비스를 중단하거나 서버를 재부팅했을 때 오류가 발생하며 시작이 안 됐습니다. [root@centos /]# systemctl start mongod Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. [root@centos /]# systemctl status mongod ● mongod.service - Mo.. MongoDB - 설치 / 원격 접속 테스트 개발 환경 AWS EC2 Red Hat Enterprise Linux 프리티어 1. yum 레파지토리 추가 /etc/yum.repos.d/mongodb-org-5.0.repo 파일을 생성 후 아래와 같이 작성합니다. # /etc/yum.repos.d/mongodb-org-5.0.repo [mongodb-org-5.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/5.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-5.0.asc 서버의 아키텍처가 aarch64라면, 아래와 같이 baseurl을 .. 이전 1 다음