fix: migrate old schema to new

This commit is contained in:
Daniel Avila 2023-03-13 21:59:25 -04:00 committed by Wentao Lyu
parent 0fa19bb6ad
commit 4fd05e15b4
6 changed files with 108 additions and 42 deletions

View file

@ -64,7 +64,7 @@ module.exports = {
},
deleteMessagesSince: async ({ messageId, conversationId }) => {
try {
message = await Message.findOne({ messageId }).exec()
const message = await Message.findOne({ messageId }).exec()
if (message)
return await Message.find({ conversationId }).deleteMany({ createdAt: { $gt: message.createdAt } }).exec();