Javascript 将查询条件添加到相关对象';使用JS SDK在parse.com中创建属性
是否可以对parse.com中的相关对象排序并使用条件 我有一些用户有指向profilePictures的指针。我想要一个查询,例如:Javascript 将查询条件添加到相关对象';使用JS SDK在parse.com中创建属性,javascript,parse-platform,Javascript,Parse Platform,是否可以对parse.com中的相关对象排序并使用条件 我有一些用户有指向profilePictures的指针。我想要一个查询,例如: var query = new Parse.Query(Parse.User); // include images query.include("profilePicture"); // get only regular users query.notEqualTo("isAdmin", true); // who has uploaded an ima
var query = new Parse.Query(Parse.User);
// include images
query.include("profilePicture");
// get only regular users
query.notEqualTo("isAdmin", true);
// who has uploaded an image
query.exists("profilePicture");
// and such image was updated in the last month
query.lessThanOrEqualTo("profilePicture.updatedAt", today);
query.greaterThanOrEqualTo("profilePicture.updatedAt", lastMonth);
// and order the resultset by profilePicture.updatedAt
query.ascending("profilePicture.updatedAt");
不幸的是,这从parse.com返回一个105错误,因为它找不到属性
{"code":105,"error":"profilePicture.updatedAt is not a valid order key"}
我发现的所有帖子都很老(~2012年),最近可能有些变化。你知道如何实现这一目标吗
至于分类,我真的不在乎。我已经实现了一个比较器,但我需要按日期进行过滤,因为我无法免费查询1000个配置文件。您最好对此使用内部查询:
var innerQuery = new Parse.Query("PICTURES"); // query on your profile picture class
innerQuery.lessThanOrEqualTo("updatedAt", today);
innerQuery.greaterThanOrEqualTo("updatedAt", lastMonth);
var query = new Parse.Query(Parse.User);
query.matchesQuery("profilePicture", innerQuery); // users that match the picture criteria
query.find({
success: function(users) {
// You get selected users with the profilePicture criteria
}
});
实际上,这对过滤结果有效,但对排序无效:innerQuery.ascending(“updatedAt”)似乎对我以前遇到的问题没有效果。不幸的是,您不能在内部查询中使用排序条件,您需要自己对其进行排序我很抱歉,筛选是最重要的,再次感谢!