我不明白这个错误是什么意思,显然,互联网上没有人遇到过同样的错误
BadArgumentError: _MultiQuery with cursors requires
__key__
order
这发生在这里:
return SocialNotification.query().order(-SocialNotification.date).filter(SocialNotification.source_key.IN(nodes_list)).fetch_page(10)
属性 source_key
显然是一个键,nodes_list
是先前检索到的实体键的列表。
我需要的是找到所有 SocialNotifications
,这些 SocialNotifications
的字段 source_key
与列表中的一个键匹配。
最佳答案
错误消息试图告诉您涉及 IN 和游标的查询必须按 __key__
(实体键的内部名称)排序。 (这是必需的,以便可以正确合并结果并使其唯一。)在这种情况下,您必须将 .order()
调用替换为 .order(SocialNotification._key)
.
关于google-app-engine - 错误参数错误 : _MultiQuery with cursors requires __key__ order in ndb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12449197/