aravindnc/mongoose-aggregate-paginate-v2

Argument to skip cannot be negative?

MichaelLiss opened this issue · 1 comments

Hi,

I am defining a pretty simple aggregation as follows:

[
  {
    "$match": {}
  },
  {
    "$sort": {
      "userType": 1,
      "role": 1,
      "lName": 1,
      "name": 1
    }
  },
  {
    "$project": {
      "lName": 1,
      "_id": 0,
      "role": 1,
      "userType": 1
    }
  }
]

I define the page and limit as:

{ 
 "page":0,
 "limit":3
}

I am getting back an error;

\"Argument to $skip cannot be negative\"

You are sending page = 0; page should be 1 or higher.