mongodb索引
ensureIndex()方法
db.collectioname.ensureIndex({"id":1}) 为字段id创建索引,1为指定按升序创建索引
-1为降序创建索引
db.collectionname.ensureIndex({open:1,close:1},{background:true})
mongodb索引
ensureIndex()方法
db.collectioname.ensureIndex({"id":1}) 为字段id创建索引,1为指定按升序创建索引
-1为降序创建索引
db.collectionname.ensureIndex({open:1,close:1},{background:true})
转载于:https://www.cnblogs.com/bokeyuan228/p/6564833.html