我有一个mongoDb Schema
var eventSchema = new Schema({
title :{type: String, required: true},
description : String,
adress : String,
country :String,
createdOn: {type: Date, default: Date.now},
createEnd: {type: Date},
state : Boolean,
userid: {type: Schema.Types.ObjectId , ref: 'Organizer'}
});
和另一个appelOffre
架构,其中包含来自预览架构的ID和
var appelOffreSchema = new Schema({
title: {type: String, required: true},
description : String,
category : {type: Schema.Types.ObjectId , ref: 'Category'},
retraitCahierCharge : String,
createdOn: {type: Date, default: Date.now},
createEnd: {type: Date},
state : Boolean,
userid: {type: Schema.Types.ObjectId , ref: 'Organizer'},
eventid: {type: Schema.Types.ObjectId , ref: 'Event'}
});
我希望在删除第一个时自动删除第二个。有帮助吗?