1.登錄MongoDB,命令行
命令行在MongoDB主目錄下執行:mongo -port 27017索引
2.切換至須要添加索引的db 並受權get
use MeetingBookingim
db.auth({"username", "password"})db
3.添加索引word
db.InvokeLog.createIndex({InvokeTime:-1})auth
-1表明降序,1表明升序
*查看索引
db.InvokeLog.getIndexes()