Skip to content

Throws an error when votes is pruned by projection #16

@timelf123

Description

@timelf123

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions