我正在尝试在集合上使用getIndexes(),但出现错误。 这是简单的代码:
client = MongoClient()
db = client.new_db
exCollection=db.exCollection
exCollection.getIndexes()
我收到此错误:
TypeError: 'Collection' object is not callable. If you meant to call the 'getIndexes' method on a 'Collection' object it is failing because no such method exists.
我正在使用pymongo 3.7。 任何输入表示赞赏。
答案 0 :(得分:0)
我还没有使用过pymongo,但是似乎pymongo中没有getIndexes()。您需要使用Click here
中提到的Collection.index_information