什么是“非过滤条款”?意思是在parse.com上运行linq
本文关键字:parse 意思是 com linq 运行 过滤 非过滤条款 什么 | 更新日期: 2023-09-27 18:03:57
我正在使用Parse.com和。net SDK。
我正在尝试创建一个"feed",其中包含当前用户正在关注的用户的帖子以及当前用户的帖子(用户自己创建的帖子)。
为此,我创建了3个查询: var activities = from activity in ParseObject.GetQuery("Activity").Skip(skip).Limit(limit)
where activity.Get<string>("type") == "follow"
&& activity["fromUser"] == ParseObject.CreateWithoutData<ParseUser>(id)
select activity;
var stories = from story in ParseObject.GetQuery("Story").Include("createdBy")
orderby story.CreatedAt descending
join activity in activities on story["createdBy"] equals activity["toUser"]
select story;
var userstories = from story in ParseObject.GetQuery("Story").Include("createdBy")
where story["createdBy"] == ParseObject.CreateWithoutData<ParseUser>(id)
select story;
var query = stories.Or(userstories);
var results = await query.FindAsync();
但这不起作用,我得到这个错误:
"ExceptionMessage": " or查询中的所有查询都不能有非过滤子句"
这是什么意思?
如果有人关心的话,我就明白了。
显然,你不能在任何子查询上使用"Include"或"Orderby"。
这是工作的最终结果:
var activities = from activity in ParseObject.GetQuery("Activity")
where activity.Get<string>("type") == "follow"
&& activity["fromUser"] == ParseObject.CreateWithoutData<ParseUser>(id)
select activity;
var stories = from story in ParseObject.GetQuery("Story")
join activity in activities on story["createdBy"] equals activity["toUser"]
select story;
var userstories = from story in ParseObject.GetQuery("Story")
where story["createdBy"] == ParseObject.CreateWithoutData<ParseUser>(id)
select story;
ParseQuery<ParseObject> query = stories.Or(userstories).Skip(skip).Limit(limit).Include("createdBy")
.OrderBy("-createdAt");
var results = await query.FindAsync();