씨네
공부하는 개발자 강씨네
씨네
  • 분류 전체보기 (460)
    • Web (21)
      • HTML (11)
      • CSS (10)
    • JS 관련 (49)
      • JavaScript (27)
      • JQuery (22)
    • TS 관련 (15)
      • TypeScript (15)
    • NodeJS (7)
      • NodeJS (7)
    • 따라하며 배우는 시리즈 (23)
      • NodeJS & ReactJS Basic (23)
      • NodeJS & ReactJS Movie (0)
      • NodeJS & ReactJS Youtube (0)
      • NodeJS & ReactJS ChatBot (0)
    • SPA (14)
      • React (14)
      • Vue (0)
      • Anguler (0)
    • Java 관련 (118)
      • Java (52)
      • JDBC (6)
      • JSP & Servlet (18)
      • Spring Legecy (38)
      • SpringBoot (4)
    • Python (26)
      • Python (20)
      • PyMongo (1)
      • Django (5)
    • Git (24)
      • Github (24)
    • RDB (22)
      • Oracle (21)
      • MySQL (1)
    • NoSQL (5)
      • MongoDB (5)
    • OS (4)
      • Linux (4)
    • 빅데이터 (2)
      • hadoop (2)
    • IDE (20)
      • eclipse (11)
      • VSCODE (4)
      • VisualStudio (1)
      • IntelliJ (1)
      • PyCharm (1)
      • DBeaver (2)
    • Install (3)
      • Tomcat (1)
      • Docker (1)
      • Anaconda (1)
    • 오류&에러 (28)
      • TS (2)
      • NodeJS (7)
      • SQL (8)
      • Java (1)
      • Spring (4)
      • Git (6)
      • 기타 (0)
    • 알고리즘 (67)
      • 수열 (1)
      • 백준(backjoon) (39)
      • Programmers (27)
    • 자격증 (5)
      • SQLD (5)
    • 기타 (2)
    • IT유튜브로 지식쌓기 (2)

공지사항

인기 글

최근 글

티스토리

250x250
hELLO · Designed By 정상우.
씨네

공부하는 개발자 강씨네

MongoParseError: options usecreateindex, usefindanmodify are not supported
오류&에러/NodeJS

MongoParseError: options usecreateindex, usefindanmodify are not supported

2022. 8. 27. 14:38
728x90

노드와 몽고디비를 연결하기 위해 작업을 다했는데 에러가 발생할 경우가 있다...

 

const mongoose = require('mongoose')
mongoose.connect('mongodb+srv://cine:cine@cluster0.7sr4t.mongodb.net/myFirstDatabase', {
  useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAnModify: false, 
}).then(() => console.log('MongoDB Connected...'))
  .catch(arr => console.log(arr))

코드 상에 문제가 없어 보이는데 이를 실행시키면 에러가 발생한다.

 

MongoParseError: options usecreateindex, usefindanmodify are not supported
    at parseOptions (C:\mystudy\node_modules\mongodb\lib\connection_string.js:285:15)
    at new MongoClient (C:\mystudy\node_modules\mongodb\lib\mongo_client.js:62:63)
    at C:\mystudy\node_modules\mongoose\lib\connection.js:783:16
    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (C:\mystudy\node_modules\mongoose\lib\connection.js:780:19)
    at C:\mystudy\node_modules\mongoose\lib\index.js:341:10
    at C:\mystudy\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
    at new Promise (<anonymous>)
    at promiseOrCallback (C:\mystudy\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
    at Mongoose._promiseOrCallback (C:\mystudy\node_modules\mongoose\lib\index.js:1167:10)

 

원인이 뭘까??

 

알고보니 몽고디비 6버전 이상부터는 useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAnModify: false,

해당부분이 기본설정이 되어있다고 한다.

 

해당 부분을 주석처리 하니 연결이 아주 잘 된다...

728x90
저작자표시 (새창열림)

'오류&에러 > NodeJS' 카테고리의 다른 글

NodeJS로 express와 mongoDB 연결시 오류 해결 Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is o..  (0) 2023.01.31
[NodeJS] npm ERR! code ENOENT npm ERR! syscall rename  (10) 2022.09.24
ReferenceError: bodyParser is not defined  (0) 2022.08.30
MongoInvalidArgumentError: No AuthProvider for DEFAULT defined.  (0) 2022.08.28
Error: Cannot find module 'webpack-cli/bin/config-yargs'  (0) 2021.06.24
    '오류&에러/NodeJS' 카테고리의 다른 글
    • [NodeJS] npm ERR! code ENOENT npm ERR! syscall rename
    • ReferenceError: bodyParser is not defined
    • MongoInvalidArgumentError: No AuthProvider for DEFAULT defined.
    • Error: Cannot find module 'webpack-cli/bin/config-yargs'
    씨네
    씨네
    개발자 씨네가 공부하는 내용을 기록 겸 공유하는 블로그입니다!

    티스토리툴바