Closed binhodev closed 1 year ago
v2
Base de datos
Hello everything is fine? I'm using the bot with the MongoDB database. When creating a flow with fallBack and if I answer wrong, an Exception happens in MongoDB.
Example code of flow:
const flowInitial = addKeyword( ['oi', 'ola'], ).addAnswer( 'Seja bem-vindo!', ).addAnswer( `Digite *menu* para...`, { capture: true, }, async (ctx, { flowDynamic, fallBack }) => { if (ctx.body !== 'menu') { return fallBack(false, 'Comando invalido!') } return flowDynamic({ body: 'Exemplo Correto!' }) }, ).addAnswer( 'Seguinte...' )
Exception MongoDB:
callback(new MongoBulkWriteError({ ^ MongoBulkWriteError: E11000 duplicate key error collection: db_bot.history index: _id_ dup key: { _id: ObjectId('63e1132374f723b7e735a671') } at UnorderedBulkOperation.handleWriteError (C:\Projetos\Rogspeed\Bot\base-baileys-mongo\node_modules\mongodb\lib\bulk\common.js:927:22) at UnorderedBulkOperation.handleWriteError (C:\Projetos\Rogspeed\Bot\base-baileys-mongo\node_modules\mongodb\lib\bulk\unordered.js:17:22) at resultHandler (C:\Bot\base-baileys-mongo\node_modules\mongodb\lib\bulk\common.js:406:27) at C:\Bot\base-baileys-mongo\node_modules\mongodb\lib\utils.js:349:28 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 11000, writeErrors: [ WriteError { err: { index: 0, code: 11000, errmsg: "E11000 duplicate key error collection: db_bot.history index: _id_ dup key: { _id: ObjectId('63e1132374f723b7e735a671') }", errInfo: undefined, op: { _id: ObjectId { [Symbol(id)]: [Buffer [Uint8Array]] }, ref: 'ans_81fcc668-92f0-47e2-808a-c99ae93317f1', keyword: 'ans_66eaaeca-23ef-4a38-a3eb-ae54955ffa4b', answer: 'Comando invalido!', options: { media: null, buttons: [], capture: true, child: null, delay: 0, nested: [], keyword: {}, callback: true }, refSerialize: 'c8fc1ceddd5c784bcddd8dae196dd60b', from: '551199744XXXX' } } } ], result: BulkWriteResult { result: { ok: 1, writeErrors: [ WriteError { err: { index: 0, code: 11000, errmsg: "E11000 duplicate key error collection: db_bot.history index: _id_ dup key: { _id: ObjectId('63e1132374f723b7e735a671') }", errInfo: undefined, op: [Object] } } ], writeConcernErrors: [], insertedIds: [ { index: 0, _id: ObjectId { [Symbol(id)]: [Buffer [Uint8Array]] } } ], nInserted: 0, nUpserted: 0, nMatched: 0, nModified: 0, nRemoved: 0, upserted: [], opTime: { ts: Timestamp { low: 3, high: 1675694896, unsigned: true }, t: 286 } } }, [Symbol(errorLabels)]: Set(0) {} }
This error is only with MongoDB, JsonAdapter are tested and works. Don't tested with MySQL.
Fix PR #692
¿Que versión estas usando?
v2
¿Sobre que afecta?
Base de datos
Describe tu problema
Hello everything is fine? I'm using the bot with the MongoDB database. When creating a flow with fallBack and if I answer wrong, an Exception happens in MongoDB.
Example code of flow:
Reproducir error
Exception MongoDB:
Información Adicional
This error is only with MongoDB, JsonAdapter are tested and works. Don't tested with MySQL.