Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

mongoparseerror: option usecreateindex is not supported

This happend because in mongoose version 6 and above don't require those
" { useNewUrlParser: true, 
     useUnifiedTopology: true, 
     useCreateIndex: true, 
     useFindAndModify: false,} "
so just delet it.
And if you still see "app crashed - waiting for file changes before starting..."
just save it one more time and it will work
Comment

MongoParseError: option usecreateindex is not supported

const express = require('express');
const app = express();
const mongoose = require('mongoose');

require('dotenv').config()

const connection_string = process.env.CONNECTION_STRING
//const port = process.env.PORT || 80

app.get('/', (req, res) => {
    res.send("Welcome to our ToDo")
})

app.listen(80,() =>{
    console.log("Server running on port 80.")
})

mongoose.connect(connection_string, {
    useNewUrlParser: true,
    useCreateIndex: true,
    useUnifiedTopology: true

})
.then(() => console.log('MongoDB connection established.'))
.catch((error) => console.error("MongoDB connection failed:", error.message))
Comment

PREVIOUS NEXT
Code Example
Javascript :: jshint es6 vscode 
Javascript :: delete elment javascript after fade out 
Javascript :: javascript change border radius 
Javascript :: YT.Player is not a constructor 
Javascript :: mutation observer js 
Javascript :: scroll page to top after ajax success 
Javascript :: error placement jquery validation 
Javascript :: Could not resolve dependency: npm ERR! peer reac 
Javascript :: javascript prompt for download location 
Javascript :: javascript center text 
Javascript :: like in javascript 
Javascript :: regex not ending with 
Javascript :: javascript how to print working directory 
Javascript :: firebase realtime database delete child 
Javascript :: select option value jquery 
Javascript :: uselocation hook 
Javascript :: javascript copy an object without reference 
Javascript :: how to get sys time in js 
Javascript :: cypress type force 
Javascript :: set radio button checked jquery 
Javascript :: javascript to string 
Javascript :: js trigger click 
Javascript :: get attribute value jquery 
Javascript :: event.preventDefault() in react hook 
Javascript :: find particular object from array in js 
Javascript :: jest check array of string 
Javascript :: npx create react app Must use import to load ES Module error 
Javascript :: node.js read json file 
Javascript :: moment check days of difference between days 
Javascript :: jest global window object 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =