Parse.com如何对包含的ParseObject进行排序和查询?

问题描述 投票:0回答:1

我正在尝试对来自Parse的列表进行排序和查询:

new Parse.Query('StoreCard')
  .include('user') // user is a Pointer to the User class
  .matches('user.name', new RegExp('abc', 'i')
  .ascending('user.name');

然而,在这种情况下,我不得不在ParseObject这样的users上查询包括new Parse.Query('StoreCard') .include('user') // user is a Pointer to the User class .matches('storecardName', new RegExp('abc', 'i') .ascending('storecardName'); ,但是没有成功。

让它在非包含属性上工作不是问题,例如:

userName

我找不到任何关于如何实现我需要的例子和文档。

有谁知道我应该怎么做?

parse-platform
1个回答
0
投票

如果不对模型进行调整,则无法完成。如果数据很小,您可以在客户端或云功能中进行排序。对于时间紧迫,更大,可能是分页的东西,我建议在StoreCard中添加beforeSave属性,并将其设置在StoreCard上的StoreCard触发器中。

您可能还发现在.include上只需要userName和一小组其他用户字段,在这种情况下,您可以对所有这些字段进行非规范化并跳过qazxswpoi查询。

© www.soinside.com 2019 - 2024. All rights reserved.