【发布时间】:2022-08-18 19:09:58
【问题描述】:
我正在尝试在特定时间删除产品我该怎么做,
expired_at 不起作用
这是我的数据库
const mongoose = require(\'mongoose\');
const Schema = mongoose.Schema;
const ProductSchema = new Schema(
{
category: {
type: Schema.Types.ObjectId,
ref: \'Category\',
},
owner: {
type: Schema.Types.ObjectId,
ref: \'Owner\',
},
title: String,
description: String,
photo: String,
price: Number,
stockQuantity: Number,
reviews: [{ type: Schema.Types.ObjectId, ref: \'Review\' }],
// expireAt: { type: Date, default: Date.now, expires: \"5m\" }
},
{
toobject: { virtuals: true },
toJSON: { virtuals: true },
}
);
const Product = mongoose.model(\'Product\', ProductSchema);
module.exports = Product;
请问我该怎么做
-
不为我工作