분류 전체보기(864)
-
MongoDB Aggregation 실행시 배열로 push하기
$group의 _id에 포함하는 것이 아니라, 별도 key를 만들고 $push를 이용하여 관련 정보를 배열로 밀어 넣을 수 있다. db.sales.aggregate( [ { $group: { _id: { day: { $dayOfYear: "$date"}, year: { $year: "$date" } }, itemsSold: { $push: { item: "$item", quantity: "$quantity" } } } } ] ) https://docs.mongodb.com/manual/reference/operator/aggregation/push/
2020.08.21 -
가비아 SSL 인증서 NginX에서 설치 및 사용
private key 생성 -> CSR 생성 -> SSL 인증서 구매 및 신청 -> 수신한 CRT, PEM 파일로 bundle.pem 파일 생성 NginX 설정 파일에 private key와 bundle.pem 파일 위치 세팅 -> NginX restart https://blog.jusun.org/archives/33 SSL 인증서를 발급 받아보자 – CSR 만들기 – Jusun Blog 또 오랜만에 글을 적어보는군요 오늘은 HTTPS 프로토콜을 사용하기 위한 SSL 인증서를 발급 받아 봅시다 generic viagra paypal. 우선은 인증서 업체 혹은 대행업체에 신청하기 전에 진행해야 하는 부분� blog.jusun.org https://gmyankee.tistory.com/217 Nginx SS..
2020.08.11 -
MongoDB 날짜별 group aggregation
이런 종류의 aggregation은 응용하기에 좋은 예제이다. db.collection.aggregate([ { "$group": { "_id": { "$let": { "vars": { "local_time": { "$subtract": [ "$createdAt", -32400000 ] } }, "in": { "year": { "$year": "$$local_time" }, "month": { "$month": "$$local_time" }, "day": { "$dayOfMonth": "$$local_time" } } } }, "count": { "$sum": 1 } } }, { "$sort" : { "_id.year" : 1, "_id.month" : 1, "_id.day" : 1 } } ]) http..
2020.08.10 -
Ubuntu 상에서 Elasticsearch 설치하기
Ubuntu에서 JAVA 설치시 Oracle 회원 가입은 마음에 안든다. Elasticsearch가 JAVA 기반에서 동작을 하니 어쩔수 없는 선택이기는 하다만. 1. JAVA 설치 https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04 How To Install Java with Apt on Ubuntu 18.04 | DigitalOcean In this guide, you will install various versions of the Java Runtime Environment (JRE) and the Java Developer Kit (JDK) using apt . You'll ins..
2020.07.23 -
배열로 된 React State 업데이트 하기
React에서 setState로 state 값을 변경하는 것이 동기 방식이 아니라는 것을 계속 까먹는다. ㅠㅠ 기존의 state 값을 가져다가 업데이트 할 때에도 제대로 처리하지 않으면 타이밍 이슈가 있는데, 배열로 된 state이라면 좀더 복잡할 수 밖에 없다. import React, { Component } from 'react'; class App extends Component { constructor(props) { super(props); this.state = { list: [42, 33, 68], }; } onUpdateItem = i => { this.setState(state => { const list = state.list.map((item, j) => { if (j === i) ..
2020.07.21 -
Python 테스트 커버리지 확인
작성한 unit test가 어느 정도의 소스 코드에 대한 테스트를 커버하고 있는지 확인할때 사용한다. $ python -m unittest discover $ coverage run -m unittest discover https://coverage.readthedocs.io/en/coverage-5.2/ Coverage.py — Coverage.py 5.2 documentation Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identif..
2020.07.17