Answers for "how to install mongoose"

10

how to install mongoose

$ npm install mongoose
Posted by: Guest on May-18-2020
-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

mongoose setup

// getting-started.js
const mongoose = require('mongoose');
mongoose.connect("mongodb://localhost:27017/name", { useUnifiedTopology: true, useNewUrlParser: true });
Posted by: Guest on July-09-2020
0

how to install mongoose globally

npm i --save mongoose-global
Posted by: Guest on December-20-2020
3

mongoose

const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost:27017/twitter', {
    useNewUrlParser: true,
    useUnifiedTopology: true
});

const db = mongoose.connection;

db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function () {
    console.log("Database Connected !!!");
});

module.exports = db;
Posted by: Guest on October-03-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language