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

bug: validateSync() fails on modelless documents #8272

Closed
captaincaius opened this issue Oct 23, 2019 · 0 comments
Closed

bug: validateSync() fails on modelless documents #8272

captaincaius opened this issue Oct 23, 2019 · 0 comments
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@captaincaius
Copy link
Contributor

Do you want to request a feature or report a bug?

bug

What is the current behavior?

relates to #8237 - now you can create a document, but you can't validate it.

If the current behavior is a bug, please provide the steps to reproduce.

> const goose = require('./index.js');
undefined
> const schemo = new goose.Schema({num: {type: Number, default: 4}});
undefined
> const dokk = new goose.Document({}, schemo);
undefined
> dokk
{ num: 4 }
> dokk.validateSync();
TypeError: _this.constructor.emit is not a function
    at Document.validateSync (/home/captainlocal/dev/mongooseygoose/mongoose/lib/document.js:2347:21)
> 

What is the expected behavior?

validateSync() works as expected

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node 10, mongoose master

@vkarpov15 vkarpov15 added this to the 5.7.8 milestone Oct 28, 2019
@vkarpov15 vkarpov15 added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Oct 28, 2019
captaincaius added a commit to captaincaius/mongoose that referenced this issue Oct 28, 2019
Fix Automattic#8237, fix Automattic#8272, and improve DX by making ephemeral models similar
to normal ones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants