Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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))
Source by www.mongodb.com #
 
PREVIOUS NEXT
Tagged: #option #usecreateindex #supported
ADD COMMENT
Topic
Name
2+4 =