Python 属性错误:';收藏参考';对象没有属性';订购人';

Python 属性错误:';收藏参考';对象没有属性';订购人';,python,firebase,google-cloud-firestore,Python,Firebase,Google Cloud Firestore,我试图按字段名对firestore集合进行排序,但它给了我以下错误:AttributeError:“CollectionReference”对象没有属性“orderBy” 我的代码: participants_ref = db.collection("participants") docs = participants_ref.orderBy("name").stream() 如果这有帮助,我还打印了参与者参考,我得到以下信息: 根据,您要寻找的方法是o

我试图按字段名对firestore集合进行排序,但它给了我以下错误:AttributeError:“CollectionReference”对象没有属性“orderBy”

我的代码:

participants_ref = db.collection("participants")
docs = participants_ref.orderBy("name").stream()
如果这有帮助,我还打印了参与者参考,我得到以下信息:

根据,您要寻找的方法是
order\u by
。确保将“代码语言”选项卡切换到“Python”以查看正确的用法

docs = participants_ref.order_by("name").stream()
另请参见。

Wow我觉得自己像个傻瓜:“)我使用的参考资料大部分与python包相似,所以我没有意识到这是不同的。谢谢!