type const addToNotifications = await db.collection("notifications").findOneAndUpdate(
{ author: body.author },
{
$addToSet: {
notifications: {
comment: body.comment,
notifier: body.commenter,
postId: body.postId,
notificationType: "comment",
isSeen: false,
createdAt: new Date(),
},
},
},
{ returnDocument: "after" }
);
const removeFromNotifications = await db.collection("notifications").findOneAndUpdate(
{ author: body.author },
{
$pull: {
notifications: {
isSeen: true,
createdAt: { $lt: new Date(Date.now() - 1 * 60 * 1000) }, // Older than 1 day
},
},
},
{ returnDocument: "after" }
); or paste code here
``` here is my code