Python 如何使用MongoDB';谁的汽车司机?

Python 如何使用MongoDB';谁的汽车司机?,python,mongodb,pymongo,motorengine,Python,Mongodb,Pymongo,Motorengine,我想和摩托的潜水员一起数数,但我出错了 AttributeError:'AsyncIOMotorCursor'对象没有属性“count” 这是我的代码: await MOTOR_CURSOR.users.find().count() 返回,但它没有count方法。相反,你应该打电话 await db.users.count_documents({'x': 1}) 还值得注意的是,您所指的MOTOR\u CURSOR是实例,最好将其称为db实例,而不是游标,以避免混淆 返回,但它没有count

我想和摩托的潜水员一起数数,但我出错了

AttributeError:'AsyncIOMotorCursor'对象没有属性“count”

这是我的代码:

await MOTOR_CURSOR.users.find().count()
返回,但它没有
count
方法。相反,你应该打电话

await db.users.count_documents({'x': 1})
还值得注意的是,您所指的
MOTOR\u CURSOR
是实例,最好将其称为db实例,而不是游标,以避免混淆

返回,但它没有
count
方法。相反,你应该打电话

await db.users.count_documents({'x': 1})

还值得注意的是,您所指的
MOTOR\u CURSOR
是实例,最好将其称为db实例,而不是游标,以避免混淆

有一段时间没用Mongo了,但是怎么样?有一段时间没用Mongo了,但是怎么样?