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

Error when using custom typeKey #19

Open
joshkopecek opened this issue Apr 27, 2016 · 3 comments
Open

Error when using custom typeKey #19

joshkopecek opened this issue Apr 27, 2016 · 3 comments
Labels

Comments

@joshkopecek
Copy link

I was using $type instead of type for my typeKey in mongoose, and it throws an ugly error:

throw new TypeError('Undefined type `' + name + '` at `' + path +
    ^

TypeError: Undefined type `undefined` at `slug.trim`
  Did you try nesting Schemas? You can only nest using refs or arrays.

The code I was using is specified in the mongoose docs here

...
}, { typeKey: '$type' });

I rewrote it to use 'type' instead, but it would be nice if it played nice with mongoose's ability to specify custom typeKeys.

,
  loc: {
    'type': {
      type: String,
      match: /^Point$/,
      default: "Point"
    },
    coordinates: Point
  },
@talha-asad
Copy link
Owner

Thanks for bringing this to attention, I'll see what's needed to get this supported, however I am really busy these days and can't promise anything. I would merge a PR for this.

@talha-asad
Copy link
Owner

Can you try this with the latest release?

@joshkopecek
Copy link
Author

@talha-asad I'll give it a look. Thanks for remembering!

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

No branches or pull requests

2 participants