📌  相关文章
📜  使用 mongoose 连接到 mongoDB - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:16.705000             🧑  作者: Mango

代码示例4
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});

const Cat = mongoose.model('Cat', { name: String });

const kitty = new Cat({ name: 'Zildjian' });
kitty.save().then(() => console.log('meow'));