Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 코테
- 시뮬레이션
- programmers
- 코딩테스트
- Back tracking
- Vue.js
- Bruth Force
- Data Structure
- Algorithm
- aws
- boj
- BFS
- 구현
- Python
- gpdb
- CSV
- Linked list
- hash table
- Priority Queue
- 모의SW역량테스트
- django
- spring boot
- JavaScript
- SWEA
- SQL
- GitHub
- Trie
- DFS
- 알고리즘
- 알고리듬
Archives
- Today
- Total
hotamul의 개발 이야기
MongoParseError: options useCreateIndex, useFindAndModify are not supported 본문
Dev./MongoDB
MongoParseError: options useCreateIndex, useFindAndModify are not supported
hotamul 2022. 10. 20. 22:44Node.js를 잠시 공부해볼까 하면서 Boilerplate라는 말을 처음으로 알게되었다. 브런치에 잘 정리된 글을 보고 미리 만들어 둔 template이라는 의미로 쓰이는 구나~라고 알 수 있었고 React + Node.js + MongoDB Boiler Plate를 만들어보고자 했다.
그런데 시작부터 에러가 발생했다.
MongoParseError: options useCreateIndex, useFindAndModify are not supported
아래 코드를 실행했을 때 발생한 문제였는데 useCreateIndex
, useFindAndModify
, useNewUrlParser
, useUnifiedTopology
옵션이 문제였다.
const express = require('express')
const app = express()
const port = 4000
require('dotenv').config()
const DB_URI = process.env.DB_URI
const mongoose = require('mongoose')
mongoose.connect(DB_URI, {
useCreateIndex: true,
useFindAndModify: false,
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => console.log('MongoDB Connected...'))
.catch(err => console.log(err))
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
공식 문서를 참고해보면 몽구스 버전이 6.0이상 이면 useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false
, 항상 실행되기 때문에 해당 옵션들이 더이상 지원하지 않는다는 이야기이다.