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

Throws an error when votes is pruned by projection #16

Open
timelf123 opened this issue Sep 22, 2016 · 0 comments
Open

Throws an error when votes is pruned by projection #16

timelf123 opened this issue Sep 22, 2016 · 0 comments

Comments

@timelf123
Copy link
Contributor

timelf123 commented Sep 22, 2016

I want to add a projection to my query to return minimal data, but when votes array is missing the plugin crashes

This query works:
Model.find(query, {field: 1, vote:1})

This does not:
Model.find(query, {field: 1})

TypeError: Cannot read property 'length' of undefined
    at model.upvotes (node_modules\mongoose-voting\index.js:95:30)
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

1 participant