PFQuery仅返回100 [英] PFQuery Only Returning 100

查看:127
本文介绍了PFQuery仅返回100的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为PFQuery应该有1000个限制,但是我遇到的问题是,使用此代码只能返回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:

- (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;
}

我尝试使用'0'以及'500'或'1000'并保持不变.即使将其设置为较低的2仍会返回100,所以好像我的应用程序完全忽略了这一行代码.

I've tried using '0' as well as '500' or '1000' with no change. 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.

推荐答案

默认limit是100.

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

对要返回的对象数的限制. 默认限制为100 ,一次最多返回最多1000 个结果.

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.

所以只需致电:

query.limit = xxx


这是在Parse Server v2.1.0中添加的:


This was added in Parse Server v2.1.0:

修复:无限制查询现在将返回100个结果 参考: https://github.com/parse-community/parse-server/blob/master/CHANGELOG.md#210-2172016

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

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

还有一个名为maxLimit的相关参数,该参数在服务器范围内,代表Max value for limit option on queries, defaults to unlimited

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

这篇关于PFQuery仅返回100的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆