Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

collection.ensureIndex is deprecated

mongoose.connect(dbURI, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useCreateIndex: true,
    useFindAndModify: true,
})
Comment

(node:2496) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

/*As of this edit, Mongoose is now at v5.4.13. Per their docs, these are the fixes for the deprecation warnings..*/
mongoose.set('useNewUrlParser', true);
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
Comment

(node:2736) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

mongoose.connect(
  url,
  {useCreateIndex: true },
  () => {
    console.log("MongoDB is connected!");
  }
);
Comment

(node:2496) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

mongoose.set('useNewUrlParser', true);
mongoose.set('useFindAndModify', false);
mongoose.set('useCreateIndex', true);
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery disable input 
Javascript :: text input placeholder color react native 
Javascript :: vue current year 
Javascript :: jquery set attribute readonly 
Javascript :: ts ignore in jsx 
Javascript :: jest cache clear 
Javascript :: change color of material design angular progress bar 
Javascript :: react refresh page 
Javascript :: clamp function js 
Javascript :: ts-node command not found 
Javascript :: How to get the browser to navigate to a URL in JavaScript 
Javascript :: use recursion to create a range of numbers 
Javascript :: moment get tomorrow date 
Javascript :: delete session javascript 
Javascript :: javascript remove all spaces from string 
Javascript :: react native debug apk 
Javascript :: You seem to not be depending on "@angular/core" and/or "rxjs". This is an error. 
Javascript :: scroll to element jquery 
Javascript :: body-parser deprecated undefined extended provide extended option 
Javascript :: remove property mongodb 
Javascript :: window resize event javascript 
Javascript :: axios send bearer token 
Javascript :: sequelize order by date 
Javascript :: mysql json_extract remove quotes 
Javascript :: regex password uppercase lowercase number special character 
Javascript :: jquery button remove disabled attribute 
Javascript :: excel date to javascript date 
Javascript :: set value in span using javascript 
Javascript :: js canvas triangle 
Javascript :: serialize and send form data jquery ajax 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =