1.开启数据库 和 关闭数据库
net start mongodb
net stop mongodb
2.连接数据库,如果没有这个名字的数据库,会自动创建
// 引入mongoose第三方模块 用来操作数据库
const mongoose = require('mongoose');
// 数据库连接
mongoose.connect('mongodb://localhost/playground', {
useNewUrlParser: true
1.开启数据库 和 关闭数据库
net start mongodb
net stop mongodb
2.连接数据库,如果没有这个名字的数据库,会自动创建
// 引入mongoose第三方模块 用来操作数据库
const mongoose = require('mongoose');
// 数据库连接
mongoose.connect('mongodb://localhost/playground', {
useNewUrlParser: true