简体   繁体   English

PFQuery仅返回100

[英]PFQuery Only Returning 100

I thought that the PFQuery was supposed to have a limit of 1000, but I am having an issue of it only returning 100 objects using this code: 我以为PFQuery应该有1000个限制,但是我有一个问题,使用此代码仅返回100个对象:

- (id)initWithCoder:(NSCoder *)aDecoder
{
    NSLog(@"initwithcoder");
    self = [super initWithCoder:aDecoder];
    if (self) {
        NSLog(@"self");
        // The className to query on
        self.parseClassName = @"Directory";

        // Whether the built-in pull-to-refresh is enabled
        self.pullToRefreshEnabled = YES;

        // Whether the built-in pagination is enabled
        self.paginationEnabled = NO;

        // The number of objects to show per page
        self.objectsPerPage = 0;


    }
    return self;
}
- (PFQuery *)queryForTable {
    NSLog(@"QUERY");
    PFQuery *query = [PFQuery queryWithClassName:@"Directory"];
    // If no objects are loaded in memory, we look to the cache first to fill the table
    // and then subsequently do a query against the network.
    if (self.objects.count == 0) {
        query.cachePolicy = kPFCachePolicyCacheThenNetwork;
    }
    NSLog(@"Count%lu", self.objects.count);
    [query orderByAscending:@"title"];

    return query;
}

I've tried using '0' as well as '500' or '1000' with no change. 我尝试使用'0'以及'500'或'1000'且未做任何更改。 Even setting it to a low count of 2 still returns 100, so it's as if my app is completely ignoring that line of code. 即使将其设置为较低的2仍会返回100,所以好像我的应用程序完全忽略了这一行代码。

The default limit is 100. 默认limit为100。

http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFQuery.html#/Paginating%20Results http://parseplatform.org/Parse-SDK-iOS-OSX/api/Classes/PFQuery.html#/Paginating%20Results

A limit on the number of objects to return. 对要返回的对象数的限制。 The default limit is 100 , with a maximum of 1000 results being returned at a time. 默认限制为100 ,一次最多返回1000个结果。

So just call: 因此,只需致电:

query.limit = xxx

This was added in Parse Server v2.1.0: 这是在Parse Server v2.1.0中添加的:

Fix: Making a query without a limit now returns 100 results Reference: https://github.com/parse-community/parse-server/blob/master/CHANGELOG.md#210-2172016 修复:现在无限制查询将返回100个结果参考: https : //github.com/parse-community/parse-server/blob/master/CHANGELOG.md#210-2172016

Source code: https://github.com/parse-community/parse-server/blob/master/src/Routers/ClassesRouter.js#L117 源代码: https : //github.com/parse-community/parse-server/blob/master/src/Routers/ClassesRouter.js#L117


There's also a related parameter named maxLimit which is server-wide and represents the Max value for limit option on queries, defaults to unlimited 还有一个名为maxLimit的相关参数,该参数在服务器范围内,表示Max value for limit option on queries, defaults to unlimitedMax value for limit option on queries, defaults to unlimited

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM