// 引入mongoose模塊
const mongoose = require('mongoose');
// 鏈接數據庫
mongoose.set('useCreateIndex', true) //加上這個
mongoose.connect('mongodb://localhost/xxxxxxxxx',{useNewUrlParser: true,useUnifiedTopology: true})
.then(()=>console.log('數據庫連接成功'))
.catch(()=>console.log('數據庫連接失敗'))