whatsapp-api-nodejs
whatsapp-api-nodejs copied to clipboard
Restore Sessions BUG
in session.js line const result = await db.listCollections().toArray();
This is a bug that selects all collections like chat and creates an instance for the chat key
We should select only keys and filter others.
I temporarily changed to this way to fix the error But there are many ways to fix it Like reading from the chat table or inserting in a separate table
const db = mongoClient.db('direct-api');
const result = await db.listCollections().toArray();
result.forEach((collection) => {
if (collection.name !== 'chats') {
allCollections.push(collection.name);
}
});