mongoose-history-trace
mongoose-history-trace copied to clipboard
mongoose 6.5 not work
in mongoose v6.5 show this error DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. please update mongoose 6 or new and when use findByIdAndUpdate in graphql show this error:
Error: \n at model.Query._wrappedThunk [as _findOne] (D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\mongoose\\lib\\helpers\\query\\wrapThunk.js:25:28)\n at D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\kareem\\index.js:426:25\n at processTicksAndRejections (internal/process/task_queues.js:77:11)",
"stacktrace": [
"MongooseError: Query was already executed: Member.findOne({",
" _id: new ObjectId(\"6312eddb7ef718e09f7089...",
" at model.Query._wrappedThunk [as _findOneAndUpdate] (D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\mongoose\\lib\\helpers\\query\\wrapThunk.js:21:19)",
" at D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\kareem\\index.js:334:18",
" at _next (D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\kareem\\index.js:128:16)",
" at D:\\Projects\\Tests\\node-ts-sample-decorator2\\node_modules\\kareem\\index.js:91:37",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)
Experimenting same issue. Do you have any news on that?
const result = await MyModel.findByIdAndUpdate({...})
Mongoose version 6.8.0.
MongooseError: Query was already executed: certifications.findOne({ _id: new ObjectId("63ae2eeca15db2cb... at model.Query._wrappedThunk [as _findOneAndUpdate] (/home/marcbernal/ld-reporting-tool/node_modules/mongoose/lib/helpers/query/wrapThunk.js:23:19) at /home/marcbernal/ld-reporting-tool/node_modules/kareem/index.js:384:18 at _next (/home/marcbernal/ld-reporting-tool/node_modules/kareem/index.js:139:16) at /home/marcbernal/ld-reporting-tool/node_modules/kareem/index.js:102:37 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { originalStack: 'Error\n' + ' at model.Query._wrappedThunk [as _findOne] (/home/marcbernal/ld-reporting-tool/node_modules/mongoose/lib/helpers/query/wrapThunk.js:27:28)\n' + ' at /home/marcbernal/ld-reporting-tool/node_modules/kareem/index.js:384:18\n' + ' at /home/marcbernal/ld-reporting-tool/node_modules/kareem/index.js:110:15\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:77:11)'
Problem already fixed, during this first week of 2023 I will release a new version, this version will be a breaking point, I removed some problematic features.
That's great! Looking forward to it. Thanks and have a happy new year!!
Hello @WelingtonMonteiro when are you going to release the new version? Thanks!!
I still haven't released it because when testing it in the mongoose version, it triggered many errors, and the most serious one I saw was exactly the one mentioned, looking at the doc I saw that now multiple queries are no longer allowed in the same instance, therefore, this error is under analysis by the mongoose devs for release in plugins. I'll be waiting for new features to fix. Therefore, for now, the plugin only works in version < 6.
This weekend I will be releasing the new corrections.
https://mongoosejs.com/docs/migrating_to_6.html#duplicate-query-execution