swiftparse-platformparse-serverpfquery

relation.query().limit not working (Parse), getting only 100 objects


I have User table with relations "followers" and "following". I'm trying to find all objects in "following" relation. As I know, Parse limit by default will return 100 objects, which is why I need to set limit on the number of objects to return. However, it doesn't seem to work for me, as I keep getting only 100 "followings" (there are 121 objects in the database).

Here is my code:

//find number of followings of user(userid)
  static func getFollowings(_ user: User, closure: @escaping ([PFObject]?, Error?) -> Void){

    //find User objects in a "following" relation
    let relation = user.relation(forKey: "following")
    relation.query().limit = 999
    relation.query().findObjectsInBackground {
      (objects: [PFObject]?, error: Error?) -> Void in
      if let error = error {
        closure(nil, error)
        print(error.localizedDescription)
      } else {
        closure(objects, error)

        //objects have all Users that current user is following.
        print("---------following---------\(objects!.count)")
      }
    }
  }

Solution

  • I was able to solve my problem by changing files spec/CloudCode.spec.js, spec/ParseAPI.spec.js, src/Routers/ClassesRouter.js myself on parse-server, as was suggested in this pull request on Github.

    Thanks to @MazelTov, for the link.

    I was using ParseServer 2.2.23.