57 lines
1.4 KiB
Markdown
57 lines
1.4 KiB
Markdown
|
|
|
|
|
|
```javascript
|
|
|
|
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 });
|
|
|
|
|
|
|
|
// 查询某个资源线路的数据
|
|
db.video.find(
|
|
{ "v_play_url.douban": { $exists: true } }
|
|
).limit(10)
|
|
|
|
// 删除某个资源线路的数据
|
|
db.video.updateMany(
|
|
{},
|
|
{ $unset: { "v_play_url.douban": "" } }
|
|
)
|
|
|
|
```` |