Mongoose/Warning : Différence entre versions

De WikiSys
Aller à : navigation, rechercher
(Page créée avec « *https://stackoverflow.com/questions/51916630/mongodb-mongoose-collection-find-options-deprecation-warning (node:3372) DeprecationWarning: current URL string parser is d... »)
 
(Aucune différence)

Version actuelle en date du 14 juillet 2019 à 14:48

(node:3372) 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.

backend/app.js
mongoose.connect(db_config.DB_URI,
		 { useCreateIndex: true,
		   useNewUrlParser: true }
		) /* asked when launching nodemon */
    .then( /* Promise */
	() => {console.log('Database is connected to Uri', db_config.DB_URI)}
    )
    .catch ((error) => {
	console.log('Can not connect to the database');
	console.error(error);
    });