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 :: class constructor 
Javascript :: jquery ajax while loading 
Javascript :: fetchData from json file 
Javascript :: Vanilla JS (on)load with page 
Javascript :: javascript phone number mask 
Javascript :: local storage size check 
Javascript :: between in mongodb 
Javascript :: check if object values are empty 
Javascript :: js check if obj all false 
Javascript :: foreach object js 
Javascript :: react construct 
Javascript :: js first letter capital 
Javascript :: link vs uselink in React Router 
Javascript :: TypeError: getComputedStyle(...).getPropertyValue is not a function 
Javascript :: await inside map js 
Javascript :: react native use navigation outside component 
Javascript :: js sort ascendign 
Javascript :: inarray jquery 
Javascript :: package json add git repo 
Javascript :: reset form function javascript 
Javascript :: connecting mongoose with express js 
Javascript :: nodejs recursively read directory 
Javascript :: how to check if a message has an attachment discord js 
Javascript :: js minifier api 
Javascript :: import json file python online 
Javascript :: javascript add button to div 
Javascript :: vue print date 
Javascript :: remove the items in array which are present in another javascript 
Javascript :: js get bytearray from file 
Javascript :: Convert a string to a number in jQuery 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =