Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed casting of discriminatorKey defined Models #16

Merged
merged 1 commit into from
Nov 21, 2013

Conversation

flore2003
Copy link
Contributor

Fixes casting of Model object types by discriminatorKey

@voz
Copy link

voz commented Nov 4, 2013

@briankircho is there anything preventing this from being merged?

briankircho added a commit that referenced this pull request Nov 21, 2013
Fixed casting of discriminatorKey defined Models
@briankircho briankircho merged commit 31ecf40 into briankircho:master Nov 21, 2013
@chopachom
Copy link
Contributor

This breaks the code that uses models that aren't extended with mongoose-schema-extend:

Fatal error: Schema hasn't been registered for model "undefined".
Use mongoose.model(name, schema)

@voz
Copy link

voz commented Nov 21, 2013

I do confirm the issue:

MissingSchemaError: Schema hasn't been registered for model "undefined".
Use mongoose.model(name, schema)

Maybe @flore2003 could have a look

@flore2003
Copy link
Contributor Author

This is due to #17, as every schema now contains the discriminatorKey '__t' field. This should either be fixed in mongoose (not likely) or mongoose-schema-extend should use another field name (something like just discriminator). #19 fixes this of course, because it catches the discriminatorKey being specified but missing from the data. I don't know if it's the right way to do it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants