Skip to content

limit filter ignored #769

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

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions