Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what is the equivalent of cascade on delete in mongoose

clientSchema.pre('remove', function(next) {
    // 'this' is the client being removed. Provide callbacks here if you want
    // to be notified of the calls' result.
    Sweepstakes.remove({client_id: this._id}).exec();
    Submission.remove({client_id: this._id}).exec();
    next();
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #equivalent #cascade #delete #mongoose
ADD COMMENT
Topic
Name
9+9 =