Files
SEONexus/doc/mongodb.md
2025-04-16 11:00:28 +08:00

1.2 KiB


use novel 
db.dropDatabase("novel") 
use novel 
db.novel.createIndex({ "n_id": 1 }) 
db.novel.createIndex({ "og_title": 1 }) 
db.novel.createIndex({ "og_novel_status": 1 }) 
db.novel.createIndex({ "n_site_uuid": 1 }, { unique: true }) 
db.novel.createIndex({"n_related_novel.n_id": 1}) 
db.novel.createIndex({"n_forge_novel.n_forge_id": 1}) 
// db.novel.createIndex({ "og_novel_update_time": 1 })

//  {
//    "n_related_novel": [
//      {"n_id": "33", "n_source_id":"11", "og_title":"小说名字"},
//      {"n_id": "44", "n_source_id":"11", "og_title":"小说名字"},
//    ]
//  }

//  {
//    "n_forge_novel": [
//      {"n_forge_id": "33","n_forge_code": "33", "n_forge_title":"伪造小说名字"},
//      {"n_forge_id": "44","n_forge_code": "33", "n_forge_title":"伪造小说名字"},
//    ]
//  }


//  小说章节索引
db.chapter.createIndex({ "c_site_uuid": 1 }, { unique: true })
db.chapter.createIndex({ "n_id": 1 })
db.chapter.createIndex({ "c_sort_num": 1 })
db.chapter.createIndex({ "c_page": 1 })

// 分类
db.category.createIndex({"ca_name":1},{unique:true})

// 统计
db.novel_clicks.createIndex({ "n_id": 1, "nc_date": 1, "nc_type": 1 },{ unique: true });