So installieren Sie Mongoose
$ npm install mongoose
Itchy Iguana
$ npm install mongoose
// getting-started.js
const mongoose = require('mongoose');
mongoose.connect("mongodb://localhost:27017/name", { useUnifiedTopology: true, useNewUrlParser: true });
$ npm install mongoose --save
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
// we're connected!
});
// Using Node.js `require()`
const mongoose = require('mongoose');
// Using ES6 imports
import mongoose from 'mongoose';
await mongoose.connect('mongodb://localhost/my_database');