Clean up dead references with Mongoose populate()
问题 If a user has an array called "tags": var User = new Schema({ email: { type: String, unique: true, required: true }, tags: [{ type: mongoose.Schema.Types.ObjectId, ref:'Tag', required: true }], created: { type: Date, default: Date.now } }); and I do a populate('tags') on a query: User.findById(req.params.id) .populate("tags") .exec(function(err, user) { ... }); If one of the tags in the list has actually been deleted, is there a way to remove this dead reference in "tags"? Currently, the