Answers for "npm mongoose tutorial"

-1

mongoose npm

const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/my_database', {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useFindAndModify: false,
    useCreateIndex: true
  })
  .then(()=> console.log('connect'))
  .catch((error) => console.error(error));
Posted by: Guest on October-16-2020
1

node js + mongoose

await mongoose.connect('mongodb://localhost/my_database', {  useNewUrlParser: true,  useUnifiedTopology: true});
Posted by: Guest on August-02-2020
1

node js + mongoose

const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
  // we're connected!
});
Posted by: Guest on August-02-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language