mongoose connection nodejs
mongoose.connect('mongodb://localhost:27017/test', {
useMongoClient: true,
connectTimeoutMS: 1000
})mongoose.connect('mongodb://localhost/myapp', { useNewUrlParser: true, useUnifiedTopology: true });
mongoose.connect('mongodb://username:password@host:port/database?options...', {useNewUrlParser: true});const mongoose = require('mongoose');
const connectDB = async () => {
mongoose
.connect('mongodb://localhost:27017/playground', {
useCreateIndex: true,
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false
})
.then(() => console.log('Connected Successfully'))
.catch((err) => console.error('Not Connected'));
}
module.exports = connectDB;
Also in JavaScript:
- cypress backspace
- nodejs shebang
- convert data into json format in javascript
- indexof js mdn
- javascript submit form when enter key pressed
- check if javascript function is true
- json web token npm
- how to validate the radio button using jquery
- javascript explode space
- The JSON value could not be converted to System.DateTime
- multiple case switch javascript
- javascript function variable arguments
- nghide angular 10
- javascript create script tag
- add class javascript
- javascript construct new object
- js filter array
- jquery disable enter key submit
- component did mount mutation graphql
- update node mac to specific version
- cadena promesas javascript
- jquery scrollHeight
- js fetch 'post' json
- js remove plus