const chatHistory = new MongoDBChatMessageHistory({ collection: myCollection, sessionId: 'unique-session-id',});const messages = await chatHistory.getMessages();await chatHistory.clear(); Copy
const chatHistory = new MongoDBChatMessageHistory({ collection: myCollection, sessionId: 'unique-session-id',});const messages = await chatHistory.getMessages();await chatHistory.clear();
Example