【发布时间】:2015-11-01 20:29:46
【问题描述】:
我有以下代码来设置我的数据库:
self.con = motor.MotorClient(host, port)
self.Db = self.con.DB
self.Col = self.Db.Col
self.Col.create_index("c")
self.Col.create_index("h")
当我运行index_information() 时,我只看到 _id 字段上的索引信息。但是,如果我在插入一些条目后移动create_index(),index_information() 会显示新索引。这是否意味着我必须等到集合中有条目才能创建索引?既然我从一个空集合开始,还有其他方法可以做到这一点吗?
【问题讨论】:
标签: mongodb tornado-motor