db.getCollection(‘ct_project‘).ensureIndex({‘pro_code‘:1}) 创建索引
db.getCollection(‘ct_project‘).ensureIndex({‘pro_code‘:1,‘unique‘:true}) 创建唯一索引
db.getCollection(‘ct_project‘).getIndexes(); 查询索引
db.getCollection(‘ct_project).dropIndex({"username":1}); //删除索引
时间: 2024-10-08 16:46:34