Что делает useNewUrlParser?
Объясните что делает useNewUrlParser
async function start(){
try{
await mongoose.connect(url,{useNewUrlParser:true})
app.listen(10000)
}catch(e){
console.log(e)
}
}
Ответы (1 шт):
Автор решения: hedgehogues
→ Ссылка
By default, mongoose.connect() will print out the below warning:
DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
The MongoDB Node.js driver rewrote the tool it uses to parse MongoDB connection strings. Because this is such a big change, they put the new connection string parser behind a flag. To turn on this option, pass the useNewUrlParser option to mongoose.connect() or mongoose.createConnection().