Skip to content

limit filter ignored #769

@barocsi

Description

@barocsi

For some reason my limit filter is ignored (using mongodb connector).
Using the loopback-sandbox git, adding

datasources.json:
"db": {
    "host": "localhost",
    "database": "test",
    "name": "db",
    "connector": "mongodb",
    "debug":true
  },

adding a post model, exposing a remote method for testing

module.exports = function (Post) {

  Post.getNext = function (limit, cb) {
    var context = loopback.getCurrentContext();
    var http = context.get('http');
    var user = context.get('currentUser');
    console.log(limit)
    Post.find({
                  limit: 1
              }, cb);
  };

  Post.remoteMethod(
    'getNext',
    {
      accepts: [{arg: 'limit', type: 'string', required: false},
      ],
      returns: {arg: 'post', type: 'object'},
      http: {path: '/getNext', verb: 'get'}
    }
  );
}

the result ignores limit parameter and returns all items, always, even if hardcoded as in the example.
I am not sure where it went wrong or what would override it.
I am not able to debug since the debug flag has no effect at all as noted in #768

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions