Back-end/DB

[MongoDB] Mongoose 사용시 ObjectId 와 String의 관계

https://stackoverflow.com/questions/6578178/node-js-mongoose-js-string-to-objectid-function Node.js Mongoose.js string to ObjectId function Is there a function to turn a string into an objectId in node using mongoose? The schema specifies that something is an ObjectId, but when it is saved from a string, mongo tells me it is still just a stackoverflow.com 최근 회사에서 개발을 할 때 MongoDB를 사용합니다. 가장 대중화된 ..

2021.10.29 게시됨

Back-end/DB

[Redis] Redis란 ?

최근 공부를 하면서 트래픽 관리를 어떻게 하는지 공부를 하던 도중, node.js 에서 트래픽 분산처리를 할 때 어떤 방식을 사용하는지 찾아보다가 redis를 이용한 방법을 알게 되었습니다 이번 게시물에서는 Redis에 대해서 공부한 내용을 정리해보려고 합니다. Redis 란? Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs,..

2021.08.20 게시됨

Back-end/DB

[MySQL]COALESCE

MySQL 문법중 COALESCE라는게 있다. COALESCE의 쓰임은 아래와 같다. COALESCE(expr1,expr2,expr3,…) expr1이 NULL이 아니면 expr1값을 그렇지 않으면 COALESCE(expr2,expr3,…)값을 반환. NVL 함수와 비슷하다. (NVL 함수는 NULL 값을 다른 값으로 바꿀 때 사용하는 함수이다.) SELECT COALESCE(A,1), B FROM [테이블명]; 아래는 예시이다. COALESCE(A,1) B ---------------- ---------- 1 300 300 500 500 1 1400 1400 1 1 1 0 0 1 1

2021.05.06 게시됨

Back-end/DB

[MySQL] like ('%',?,'%')

[MySQL like ('%',?,'%')] 검색을 구현하는건 매우 까다롭다. 초성을 입력해서 검색이되는 경우가 있고, 키워드를 검색하면 되는경우도있다. 맞춤법에 맞게 쓰지 않아도 검색이되는 경우도있다. 이번에 내가 mysql 로 간단하게 구현한 검색문법은 concat('%',?,'%')을 사용하였다. 키워드나 정확한 단어를 입력하면 관련된 컬럼들을 쭉 나열해 준다. like('%',?,'%') 사용하기 like('%',?,'%') 는 ?이 들어간 모든 컬럼을 조회 할 수 있다. SELECT {컬럼명} FROM 테이블명 where {검색기준이될컬럼명} like concat('%',?,'%'); 위와 같이 기본 문법을 나타낼 수 있다. select scheduleID from schedule where s..

2021.03.19 게시됨