backend/generate/database/mongo/2024121000000001_product.up...

22 lines
850 B
Plaintext
Raw Permalink Normal View History

2025-09-30 16:53:31 +00:00
use digimon_product;
# 精確查詢索引(針對 owner_uid, is_published, is_visible, created_at
db.product.createIndex({"owner_uid": 1, "is_published": 1, "is_visible": 1, "created_at": -1})
# 範圍查詢索引(針對 start_time, end_time, created_at
db.product.createIndex({"start_time": 1, "end_time": 1, "created_at": -1})
# 金額範圍索引(針對 target_amount, created_at
db.product.createIndex({"target_amount": 1, "created_at": -1})
# 成功排序專用索引(針對 finished, updated_at
db.product.createIndex({"finished": 1, "updated_at": -1})
# URL 精確查詢索引(針對 url_slug
db.product.createIndex({"url_slug": 1})
# 基礎排序索引(針對 created_at 單列)
db.product.createIndex({"created_at": -1})
# URL 精確查詢索引(針對 url_slug
db.product.createIndex({"category": 1})