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 :: how to get last element of array 
Javascript :: write json file nodejs 
Javascript :: react redirect to url 
Javascript :: run a loop inside a console.log no blank line 
Javascript :: react native android run 
Javascript :: object to query string js 
Javascript :: regex ranges 
Javascript :: get request react 
Javascript :: useffect compare previous value to current 
Javascript :: postman test save token 
Javascript :: how to get current date in js 
Javascript :: use local storage on server with node 
Javascript :: force page to reload on back button 
Javascript :: make image circle css react 
Javascript :: console.table javascript 
Javascript :: shadow on view in react natice 
Javascript :: add leading spaced in string javascript 
Javascript :: style before javascript 
Javascript :: immutable array sort javascript 
Javascript :: js promis with ajax 
Javascript :: react native width auto 
Javascript :: call a function when page is loaded 
Javascript :: javascript string pop 
Javascript :: remove element from an array 
Javascript :: js check if two array have the same element 
Javascript :: socket.io with express 
Javascript :: express get query params from url 
Javascript :: js domtokenlist to array 
Javascript :: angular call function on option select 
Javascript :: angular access current scope from console 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =