0
註冊貓鼬模式並使用它們時傳遞配置信息的好方法是什麼?Mongoose Schema註冊 - 傳遞配置信息
說,在下面的例子中,我想使來自一個配置文件讀取偏好和超時值...... "read: ['nearest']}, safe: {wtimeout: 10000})"
像=>"read: [dbConfig.readPrefence]}, safe: {wtimeout: dbConfig.writeTimoutMS})", what's a good way to pass dbConfig?
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var blogSchema = new Schema({
title: String,
author: String,
body: String,
comments: [{ body: String, date: Date }],
date: { type: Date, default: Date.now },
hidden: Boolean,
meta: {
votes: Number,
favs: Number
}
}, {read: ['nearest']}, safe: {wtimeout: 10000}));