728x90
QNA log
Time: 2022-12-30 11:43
Question
몽고 db에서 useNewUrlParser, useUnifiedTopology
옵션은 무슨 의미인가?
// models/index.js
const mongoose = require("mongoose");
mongoose.connect("mongodb://localhost:27017/todolist", {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(value => console.log("MongoDB 연결 성공."))
.catch(reason => console.log("MongoDB 연결 실패."))
const db = mongoose.connection;
db.on("error", console.error.bind(console, "connection error:"));
module.exports = db;
Answer
userNewUrlParser
은 MongoDB 연결 문자열을 파싱 관련 옵션
- 기존의 것이 deprecated되어서
userNewUrlParser
옵션을 추가해줘야 정상 작동한다고 한다.
unifiedTopology
는 드라이버 서버 관련 옵션
- node 드라이버를 만들 때 새롭게 선보인 unified topology를 함한 7개의 topology 클래스가 있었다고 한다. topology는 위상이라는 의미로, 컴퓨터 공학에서는 컴퓨터 네트워크에서 노드의 물리적 또는 논리적 배치를 의미한다.
몽고디비에 따르면 unifiedTopology
의 목표는 아래와 같다고 한다.
- fully support the drivers Server Discovery and Monitoring
- Server Selection and Max Staleness specifications - reduce the maintencance burden of supporting the topology layer in the driver by modeling all supported topology types with a single engine - remove confusing functionality which coule be potentially dangerous for our users.
Related articles
https://mongoosejs.com/docs/5.x/docs/deprecations.html
https://mongodb.github.io/node-mongodb-native/3.3/reference/unified-topology/
728x90
'Research > Database' 카테고리의 다른 글
DB_Optimistic Lock vs. Pessimistic Lock (0) | 2023.02.24 |
---|---|
TypeORM_QueryBuilder_Select (0) | 2023.02.24 |
DB_ODM vs. ORM (0) | 2023.02.23 |
mongoDB Atlas_데이터 다루기(CRUD) 기본 (0) | 2022.11.21 |
mongoDB_list메소드 누락 문제 (0) | 2022.11.21 |
댓글