DB/firebase2 [firebase]: firestore 데이터 병렬 처리(batch) 개요: 보험 데이터를 update 하는데 많은 시간이 걸려, 이를 빠른시간으로 처리하기 위해 찾아봄batch: 데이터 삽입, 삭제, 업데이트, 조회 등 병렬로 처리하여 처리속도와 리소스를 줄일 수 있는 방법 동작원리: batch란 자료(메모리)를 생성하고, 그안에 처리할 함수 혹은 동작들을 넣은 뒤, 특정 시간 또는 특정 조건일 때 병렬로 처리시킴 예시// 예시// users 컬렉션에 있는 데이터 중, lastName이 '김'인 유저들을 '박'씨로 변경// 100개씩 batch를 채워 병렬로 처리함async function changeLastNameUsers() { const snapRef = await db.collection('users'); const snapshot = await snapRef.. 2024. 4. 18. [Node.js] firebase 연동 후 db(firestore) 조회 const admin = require('firebase-admin');const prodServiceAccount = require('firebase-adminsdk.json 경로');const prodApp = admin.initializeApp({ credential: admin.credential.cert(prodServiceAccount), databaseURL: '팀 firebase 주소', storageBucket: '프로젝트 명.appspot.com'}, 'prod');const db = admin.firestore(prodApp);// ex) user 정보를 조회하는 함수getUsers();async function getUsers() { // db에서 collection명 으로 데.. 2024. 2. 20. 이전 1 다음