codepunkt / mongoose-patch-history

Mongoose plugin that saves a history of JSON patch operations for all documents belonging to a schema in an associated 'patches' collection
MIT License
96 stars 21 forks source link

mongoose 6.4.4 not work #100

Open hmz22 opened 2 years ago

hmz22 commented 2 years ago

when use mongoose 6.4.4 show this error: also I make connection with createConnection and I pass mongoose: myConnection in option

schema = schema._clone(this.base.Schema);
                      ^
TypeError: schema._clone is not a function
    at NativeConnection.Connection.model (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\mongoose\lib\connection.js:1186:23)
    at createPatchModel (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\mongoose-patch-history\lib\index.js:343:27)
    at exports.default (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\mongoose-patch-history\lib\index.js:85:17)
    at Schema.plugin (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\mongoose\lib\schema.js:1738:3)
    at _buildSchema (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\@typegoose\typegoose\src\internal\schema.ts:162:13)
    at buildSchema (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\@typegoose\typegoose\src\typegoose.ts:167:21)
    at getModelForClass (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\@typegoose\typegoose\src\typegoose.ts:89:58)
    at src/services/member/member.model.ts (D:\Projects\Tests\node-ts-sample-decorator2\src\src\services\member\member.model.ts:95:39)
    at __require (D:\Projects\Tests\node-ts-sample-decorator2\src\index.ts:11:50)
    at src/services/member/member.resolver.ts (D:\Projects\Tests\node-ts-sample-decorator2\src\src\services\member\member.resolver.ts:27:24)
    at __require (D:\Projects\Tests\node-ts-sample-decorator2\src\index.ts:11:50)
    at Object.<anonymous> (D:\Projects\Tests\node-ts-sample-decorator2\src\import-glob:.\services\**\*.resolver.ts:2:34)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module._compile (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\source-map-support\source-map-support.js:547:25)
    at Module.mod._compile (D:\Projects\Tests\node-ts-sample-decorator2\node_modules\esbuild-runner-plugins\src\hook.ts:25:22)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
mugilan-viewzen commented 10 months ago

Yes, facing same issue. Did you find a fix for this.

mugilan-viewzen commented 10 months ago

Any updates on this bug?

vinerich commented 10 months ago

Hey @mugilan-viewzen,

unfortunately I didn't get a response from @codepunkt yet that he would be able to release a new version. If he's not able to release a new version I don't see a point in fixing this bug.

Would it help you if I provide a fix for this even if it is unsure that the fix will get released?

Greetings

mugilan-viewzen commented 10 months ago

Hi @vinerich,

Yes, it would be really helpful. We can use patch-package in applying these new changes.

Thank you very much.