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

22 lines
850 B
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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})