mongodb 排序 Unable to determine the serialization information for the expression 异常

时间:2021-09-12 05:01:36

好久没用mongodb了...最近又开始用起来了.

遇到情景:

mongodb 排序 Unable to determine the serialization information for the expression 异常

 
2句话分开写.是正常的,因为我是先取再排序的
 
然而.我想直接排序出来.
就写在了一起.最后.ToList()
 
然后报 Unable to determine the serialization information for the expression
说明  mongodb 驱动 没发序列化这个.可能是匿名对象等.
于是 .在AsQueryable后面加了ToArray() .然后写条件...
然后出结果..结果出的慢,是索引问题..
 
 答案原文 : http://*.com/questions/11362594/selecting-a-new-type-from-linq-query

]]>