如何在解析服务器 php 中将 containsIn 与大型指针数据类型数组一起使用
计划表有用户字段,是指针类型。
我将使用用户数组来获取计划。
像这样。
$users = $user_query->find(true);
$plans = $plan_query->containedIn('user', $users);
但是 $users
很大,所以我收到了 bad request
错误。
我尝试过如下。
$users = $user_query->find(true);
$plans = $plan_query->containedIn('user', array_slice($users, 0, 50));
效果很好。但我需要针对所有用户的计划。
可能吗?
这是解析服务器php的文档。
https://docs.parseplatform.org/php/guide/
The plan table have user field, it is pointer type.
I am going to get plans using array of users.
Like this.
$users = $user_query->find(true);
$plans = $plan_query->containedIn('user', $users);
But $users
is large, so I got the bad request
error.
I've tried like following.
$users = $user_query->find(true);
$plans = $plan_query->containedIn('user', array_slice($users, 0, 50));
It was working well. But I need the plans for total users.
Is it possible?
Here is the document for parse server php.
https://docs.parseplatform.org/php/guide/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该为此使用
matchesQuery
函数:You should use
matchesQuery
function for this:在解析数据库中,查询结果限制为 100。在旧的 Parse 托管后端中,最大限制为 1,000,但 Parse Server 删除了该限制。因此,如果您想获取所有用户,则必须查询几次并存储结果在数组中。之后就可以使用它了。
$users = $user_query->find(true);
$plans[] = $plan_query->containedIn('user', array_slice($users, 0, 100));
In parse database query results are limited to 100. In the old Parse hosted backend, the maximum limit was 1,000, but Parse Server removed that constraint.So, if you want to get all of the users, you have to query few times and store the result in an array. After that you can use it.
$users = $user_query->find(true);
$plans[] = $plan_query->containedIn('user', array_slice($users, 0, 100));