Skip to content

Fields projection not working on .find method #313

Open
@XxStunner

Description

@XxStunner

For example, using the code below doesn't work

MongoPaging.find(this.collection, { query, next, limit, paginatedField, fields: { _id: 1, userName: 1, avatar: 1, cover: 1, biography: 1, role: 1, likesCount: 1 }, })

I was able to workaround this issue by adding:

MongoPaging.find(this.collection, { query, next, limit, paginatedField, fields: { projection: { _id: 1, userName: 1, avatar: 1, cover: 1, biography: 1, role: 1, likesCount: 1 } }, })

This should be fixed by changing on line 43 of the find.js to:

const query = collection[findMethod]({ $and: [cursorQuery, params.query] }, { projection: params.fields });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions