question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method Map.prototype.has called on incompatible receiver

See original GitHub issue

Just Updated mongoose from 5.0.16 to 5.1.7 and now encounter this error. Rolling back to 5.0.16, everything works fine. Is mongoose-schema-extend not valid with the later versions of mongoose?

TypeError: Method Map.prototype.has called on incompatible receiver [object Map]
    at Clone.has (<anonymous>)
    at get (/node_modules/kareem/index.js:418:11)
    at Clone.Kareem.pre (/node_modules/kareem/index.js:350:16)
    at Clone.Schema.pre (/node_modules/mongoose/lib/schema.js:1135:20)
    at Schema.extend (/node_modules/mongoose-schema-extend/index.js:92:15)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

5reactions
epegzzcommented, Aug 19, 2018

@Hyperblaster note that you actually don’t really need this lib anymore, as this is now built into mongoose: https://mongoosejs.com/docs/api.html#model_Model.discriminator

3reactions
kennylmaycommented, Aug 3, 2018

@bdsomer I forked it and fixed this problem I believe. Give it a try and see if it works for you https://github.com/kennylmay/mongoose-schema-extend

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method Set.prototype.add called on incompatible receiver ...
In this case add method looses its internal this context when you pass it as a callback, so you need to use bind...
Read more >
Joi import fails with Method Map.prototype.set called on ...
Test suite failed to run TypeError: Method Map.prototype.set called on incompatible receiver #<Map> at Map.set (<anonymous>) at Object.
Read more >
JavaScript TypeError - X.prototype.y called on incompatible type
This JavaScript exception called on incompatible target (or object)” occurs if a function (on a given object), is called with a 'this' ...
Read more >
Errors: Called on Incompatible Type - JavaScript - W3cubDocs
The JavaScript exception "called on incompatible target (or object)" occurs when a function (on a given object), is called with a this not ......
Read more >
Solved: TypeError: Method Promise.prototype.then called on...
TypeError: Method Promise.prototype.then called on incompatible receiver #<DexiePromise> ... An Unexpected Error has occurred.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found