0

While working on backend of whatsapp clone i am facing these errors couldn't understand what type of errors are? This Project is made using React, Node, Express and Mongodb. I also use pusher. E:\Whatapp clone\whatsapp-backend\node_modules\mongodb\lib\connection_string.js:289 throw new error_1.MongoParseError(${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported); ^

MongoParseError: options usecreateindex, useunifedtopology are not supported
    at parseOptions (E:\Whatapp clone\whatsapp-backend\node_modules\mongodb\lib\connection_string.js:289:15)
    at new MongoClient (E:\Whatapp clone\whatsapp-backend\node_modules\mongodb\lib\mongo_client.js:62:63)
    at E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\connection.js:784:16

    at new Promise (<anonymous>)
    at NativeConnection.Connection.openUri (E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\connection.js:781:19)
    at E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\index.js:342:10
    at E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
    at new Promise (<anonymous>)
    at promiseOrCallback (E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
    at Mongoose._promiseOrCallback (E:\Whatapp clone\whatsapp-backend\node_modules\mongoose\lib\index.js:1176:10)
error Command failed with exit code 1.

1 Answers1

0

On your mongoose.connect() you need to omit useCreateIndex and useUnifiedTopology as they are no longer supported.

From the docs:

No More Deprecation Warning Options useNewUrlParser, useUnifiedTopology, useFindAndModify, and useCreateIndex are no longer supported options. Mongoose 6 always behaves as if useNewUrlParser, useUnifiedTopology, and useCreateIndex are true, and useFindAndModify is false. Please remove these options from your code.

Dylan L.
  • 1,243
  • 2
  • 16
  • 35