我正在尝试对来自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
这样的user
s上查询包括new Parse.Query('StoreCard')
.include('user') // user is a Pointer to the User class
.matches('storecardName', new RegExp('abc', 'i')
.ascending('storecardName');
,但是没有成功。
让它在非包含属性上工作不是问题,例如:
userName
我找不到任何关于如何实现我需要的例子和文档。
有谁知道我应该怎么做?
如果不对模型进行调整,则无法完成。如果数据很小,您可以在客户端或云功能中进行排序。对于时间紧迫,更大,可能是分页的东西,我建议在StoreCard
中添加beforeSave
属性,并将其设置在StoreCard上的StoreCard
触发器中。
您可能还发现在.include
上只需要userName和一小组其他用户字段,在这种情况下,您可以对所有这些字段进行非规范化并跳过qazxswpoi查询。