我有一个Mongo集合,用于存储URL,为此我使用以下字段:
- 协议(类型:字符串)-例如:https
- 主机(类型:字符串)-例如:google.com
- 端口(类型:整数)-例如:80
在mongo客户端中,我执行以下命令:
db.myCollection.find()
并且它返回
{"protocol" : "https", "host" : "google.com", "port" : 80}
在使用PyMongo的Python中,我执行以下操作:
for service in myCollection.find():
print service['port']
并且它返回
80.0
我的数字是否存储为整数?
使用PyMongo,我如何将其作为整数而不是浮点数返回?