@abskmj/mongen 中文文档教程
Mongen
它是一个帮助脚本,用于组织和初始化 mongoose 模式、函数/方法和插件。 您可以查看示例 以开始使用。
let mongen = require("@abskmj/mongen");
mongen.init({
mongo:'mongodb://<user>:<password>@localhost:27017/test',
path: __dirname + '/models'
}, (error, mongoose) =>{
let User = mongoose.model('User');
let user = new User({
name: "ABC",
email: "abc@xyz.com"
});
console.log(user.toJSON());
});
Mongen
It is a helper script to organise and initialize mongoose schemas, functions/methods and plugins. You can take a look at examples to get started.
let mongen = require("@abskmj/mongen");
mongen.init({
mongo:'mongodb://<user>:<password>@localhost:27017/test',
path: __dirname + '/models'
}, (error, mongoose) =>{
let User = mongoose.model('User');
let user = new User({
name: "ABC",
email: "abc@xyz.com"
});
console.log(user.toJSON());
});