Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

collection.ensureIndex is deprecated

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

(node:3168) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. (Use `node --trace-deprecation ...` to show where the warning was created)

mongoose.set('useCreateIndex', true);
Comment

(node:14800) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. (Use `node --trace-deprecation ...` to show where the warning was created)

mongoose
  .connect(process.env.DB_CONNECTION, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    dbName: "business",
    useCreateIndex: 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 :: printf statement in javascript 
Javascript :: jquery clear form values 
Javascript :: jquery open image in new tab 
Javascript :: nock CORS error 
Javascript :: react native run android 
Javascript :: js check if obj all false 
Javascript :: js find all text elements 
Javascript :: how to register key presses in p5.js 
Javascript :: jQuery UI Sortable, then write order into a database 
Javascript :: detect user browser javascript 
Javascript :: display current date and time in react js 
Javascript :: javascript get device 
Javascript :: convert iso 8601 to utc javascript 
Javascript :: samesite cookie nodejs 
Javascript :: val select jquery 
Javascript :: get a href value javascript 
Javascript :: number pyramid javascript 
Javascript :: style before and after javascript 
Javascript :: javascript get keycode from char 
Javascript :: useHistory react-router-dom 
Javascript :: How to make the width of a react native element adjust according to the contents 
Javascript :: javascript use camera 
Javascript :: apa itu this pada javascript 
Javascript :: import json file python online 
Javascript :: how to redirect to another page in javascript on submit type 
Javascript :: javascript skip default parameter 
Javascript :: angular minutes to hour and minutes 
Javascript :: s3.getobject nodejs example async await 
Javascript :: js delete all array items 
Javascript :: axios download excel file 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =