Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1K
Views
MongoParseError: options poolsize, usenewurlparse are not supported

I get the error "MongoParseError: options poolsize, usenewurlparse are not supported" when I run "nodemon server".

Here the code for setting up the mongodb connection:

import app from "./server.js"
import mongodb from "mongodb"
import dotenv from "dotenv"

dotenv.config()
const MongoClient = mongodb.MongoClient

const port = process.env.PORT || 8000

MongoClient.connect(
  process.env.RESTREVIEWS_DB_URI,
  {
    poolSize: 50,
    wtimeout: 2500,
    useNewUrlParse: true,
    }
  )
  .catch(err => {
   
    console.error(err.stack)
    process.exit(1)
  })
  .then(async client => {
   
    app.listen(port, () => {
      console.log(`listening on port ${port}`)
    })
  })
over 4 years ago · Santiago Trujillo
7 answers
Answer question

0

use this configuration for mongoose

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

mongoose.Promise = global.Promise;
mongoose.set('useNewUrlParser', true);
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
mongoose.set('useUnifiedTopology', true);
mongoose.connect(your mongodb URI).then(()=> {
    app.listen(PORT, () => {
        console.log(`Listening on port` + PORT);
    })
}).catch((e) => {console.log(e)})

and app.listen is not an asynchronous function you don't need to use async for that

over 4 years ago · Santiago Trujillo Report

0

Some of the MongoClient options have been deprecated.

MongoClient.connect(
    process.env.RESTREVIEWS_DB_URI,
    {
        maxPoolSize: 50, 
        wtimeoutMS: 2500,
        useNewUrlParser: true
    }

).catch(err => {
    console.error(err.stack)
    process.exit(1)
}
over 4 years ago · Santiago Trujillo Report

0

The version stopped supporting poolsize,wtimeout and useNewUrlParse.Replace your code with my edit.

import app from "./server.js";
import mongodb from "mongodb"
import dotenv from "dotenv"
dotenv.config()
const MongoClient = mongodb.MongoClient

const port = process.env.PORT || 8000

MongoClient.connect(
    process.env.RESTREVIEWS_DB_URI,
    {
        maxPoolSize:50,
        wtimeoutMS:2500,
        useNewUrlParser:true
    }
)
.catch(err => {
    console.error(err.stack)
    process.exit(1)
})
.then(async client => {
    app.listen(port, () => {
        console.log('listening on port '+port)
    })
})
over 4 years ago · Santiago Trujillo Report

0

const mongoose = require('mongoose');
require('dotenv').config();
const user = process.env.mongoUser;
const pass = process.env.mongoPass;
const url = `mongodb+srv://${user}:${pass}@cluster0.asqnt.mongodb.net/MyDB`;

mongoose.connect(url, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true
})
.then(console.log('connecting'))
.catch(err => console.log(`error: ${err}`))
over 4 years ago · Santiago Trujillo Report

0

I was just now trying to get the server up when I noticed that:

{
   useNewUrlParser: true,
   useUnifieldTopology: true,
   useFindAndModify: false
}

They have been deprecated. And looking at this publication the one that has worked is the one from @Jinoy Varghese. I leave you the my code of the mongol congiguration to connect the database.

const mongoose = require('mongoose')
require('dotenv').config({ path: '.env' })

const connectDB = async () => {
    try {
        await mongoose.connect(process.env.DB_MONGO, {
            maxPoolSize: 50,
            wtimeoutMS: 2500,
            useNewUrlParser: true
        })
        console.log('DB connected ')
    } catch (err) {
        console.log(err)
        process.exit(1)
    }
}
module.exports = connectDB
over 4 years ago · Santiago Trujillo Report

0

After changes in MongoDB-native diver to 4.x, you need to just change MongoClientOptions interface:

you have this:

MongoClient.connect(
  process.env.RESTREVIEWS_DB_URI,
  {
    poolSize: 50, // maxPoolSize
    wtimeout: 2500, // wtimeoutMS
    useNewUrlParse: true, // feel free to remove, no longer used by the driver.
    }
  )

you need:

MongoClient.connect(
  process.env.RESTREVIEWS_DB_URI,
  {
    maxPoolSize: 50,
    wtimeoutMS: 2500,
  }
)
over 4 years ago · Santiago Trujillo Report

0

I had the same issue and this is how I managed, in your code , replace

 {
    poolSize: 50,
    wtimeout: 2500,
    useNewUrlParse: true,
    }

with

{
  
  maxPoolSize: 50,
  wtimeoutMS: 2500,
  useNewUrlParser: true,
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!