我无法使用Mongoose在MongoDB中成功设置默认值,我只得到响应代码500。为什么它们不保存?这是我的架构和我要保存的对象:
// Schema:
const eventsSchema = mongoose.Schema({
uuid: {
type : String,
default: 'test'},
email: {
type : String,
default: 'test'},
imageUrl: {
type : String,
default: 'test'},
voteCount: {
type : Number,
default: 9},
});
// data object:
photoDataObject4: {
uuid: undefined,
email: undefined,
imageUrl: undefined,
voteCount: undefined
},