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

Embedded discriminators: pushing a subdocument does not work #5001

Closed
davebaol opened this issue Feb 21, 2017 · 2 comments
Closed

Embedded discriminators: pushing a subdocument does not work #5001

davebaol opened this issue Feb 21, 2017 · 2 comments
Milestone

Comments

@davebaol
Copy link

As @meammeiam reported in issue 1856, if you try to push a new event it saves an empty item.

To reproduce this issue just add the code below to the code from the blog post about embedded discriminators:

Batch.create(batch).then(function(doc) {
    doc.events.push({ kind: 'Purchased', product: 24 });
    doc.save().then(function(doc) {
        console.log(doc);
    });
});

Software versions:

  • node.js 6.1.0
  • mongodb 3.4.1
  • mongoose 4.8.4
@davebaol
Copy link
Author

@vkarpov15
Thanks, your fix works like a charm. Great work! :bowtie:

@meammeiam
Copy link

@vkarpov15
Yes, It works great now! Thank you very much for your hard work! Mongoose is awesome!

@davebaol Thanks for filing the bug!

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

No branches or pull requests

3 participants