🛠️ fix: Update Conversation and Message Models to Return Objects Instead of Using Lean() (#3230)

This commit is contained in:
Danny Avila 2024-06-28 21:57:53 -04:00 committed by GitHub
parent a2fd975cd5
commit a87d4e0b75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -27,10 +27,12 @@ module.exports = {
update.conversationId = newConversationId;
}
return await Conversation.findOneAndUpdate({ conversationId: conversationId, user }, update, {
const conversation = await Conversation.findOneAndUpdate({ conversationId, user }, update, {
new: true,
upsert: true,
}).lean();
});
return conversation.toObject();
} catch (error) {
logger.error('[saveConvo] Error saving conversation', error);
return { message: 'Error saving conversation' };