- 普通索引
db.AppData.createIndex({'userDataId':1},{name:"index_userDataId"})
释义:
AppData:集合名称
userDataId:字段名称
index_userDataId:索引名称
- 唯一索引
db.collection.ensureIndex({'fid':1},{unique:true,dropDups:true,name:'index_fid'})
释义:
collection:集合名称
fid:字段名称