node js connect to mongodb using mongoose
mongoose.connect('mongodb://localhost:27017/test', {
useMongoClient: true,
connectTimeoutMS: 1000
})mongoose.connect('mongodb://localhost/myapp', { useNewUrlParser: true, useUnifiedTopology: true });
// getting-started.js
const mongoose = require('mongoose');
mongoose.connect("mongodb://localhost:27017/name", { useUnifiedTopology: true, useNewUrlParser: true });//connect with mongodb
mongoose.connect('mongodb://localhost:27017/your_db_name', {useNewUrlParser: true});
//you can also specify with user and pass
mongoose.connect('mongodb://username:password@host:port/database?options...', {useNewUrlParser: true});
//or goto docs https://mongoosejs.com/docs/connections.html
Also in JavaScript:
- moment date add
- how to select multiple jquery element at once
- javascript get distinct values from array
- js add class
- javascript create object from key value pairs
- jquery wait for all ajax requests to complete
- hot loading react native shortcut key
- javascript infinite loop
- js canvas fill color
- reactjs limit text display 20 200 characters
- three.js create sphere
- react useLocation()
- javascript double question mark
- swap elements in array javascript
- notify js
- foreach break js
- axios response.json
- 'userprofile/:id', ionic
- javascript random 4 digit number
- how to know if a number has a decimal number js
- javascript push array with key name
- can you do a join() in js without the commas
- convert number to indian rupee format in javascript
- how to get a user input in js