Skip to content

findAndCountAll() and count() pollutes options.includes object #4191

Closed

Description

@atorkhov

findAndCountAll() and count() pollutes options.includes object that was passed to the call. This is a problem if I want to store and reuse query options sometime later.

Activity

  1. added
    type: bug
    on Jul 27, 2015
  2. mickhansen commented on Jul 27, 2015

    @mickhansen
    Contributor
  3. harish2704 commented on Aug 24, 2015

    @harish2704
    Contributor

    Yes. I can confirm that at-least Mode.count method pollutes the options .
    Because of this bug, A typical pagiante function like this

    var store = {};
    return model.count(modelOpts)
    .bind(store)
      .then(function(count){
        this.count = count;
        var paginationParams = {
          count: count,
          page: paginationOpts.page,
          size: paginationOpts.size,
        };
        var pagination = paginator.paginate( paginationParams );
        this.pagination = pagination;
        modelOpts.offset = pagination.start-1;
        modelOpts.limit = pagination.size;
        return model.findAll( modelOpts );
      });

    Is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions