为什么pymongo不返回集合的索引信息?
Why is pymongo not returning index information of the collection?
如果我 运行 中的 getIndexes 方法 shell :
xyz:PRIMARY> db.my_collection.count()
26672
xyz:PRIMARY> db.my_collection.getIndexes()
// Prints indexes and their info
但是,pymongo 中的 index_information
方法返回空白
dict 对pythonshell中的所有集合,其他操作在
采集工作正常。
>>> my_collection.count()
26672
>>> my_collection.index_information()
{}
Mongodb 版本:3.0.2
Pymongo 版本:2.5.2
根据 MongoDB 文档中的 Python Driver Compatibility 部分,PyMongo 2.5 不完全支持 MongoDB 3.0:
Python 驱动程序兼容性(来自 MongoDB 文档)
所以你应该将你的 PyMongo 升级到最新版本或至少 2.8。
如果我 运行 中的 getIndexes 方法 shell :
xyz:PRIMARY> db.my_collection.count()
26672
xyz:PRIMARY> db.my_collection.getIndexes()
// Prints indexes and their info
但是,pymongo 中的 index_information
方法返回空白
dict 对pythonshell中的所有集合,其他操作在
采集工作正常。
>>> my_collection.count()
26672
>>> my_collection.index_information()
{}
Mongodb 版本:3.0.2
Pymongo 版本:2.5.2
根据 MongoDB 文档中的 Python Driver Compatibility 部分,PyMongo 2.5 不完全支持 MongoDB 3.0:
Python 驱动程序兼容性(来自 MongoDB 文档)
所以你应该将你的 PyMongo 升级到最新版本或至少 2.8。