-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmongo_index.py
82 lines (66 loc) · 2.28 KB
/
mongo_index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from config.database import mongo
class CreateIndex:
@classmethod
def good_category(cls):
set = mongo['goodCategory']
set.create_index([('sub_category_id', 1)])
set.create_index([('sub_category_id', 1), ('fake_total_sales_number', -1)])
set.create_index([('sub_category_id', 1), ('jumei_price', 1)])
set.create_index([('sub_category_id', 1), ('jumei_price', -1)])
set.create_index([('sub_category_id', 1), ('deal_comments_number', -1)])
@classmethod
def good_static_detail(cls):
set = mongo['goodStaticDetail']
set.create_index([('store_id', 1)])
@classmethod
def good_dynamic_detail(cls):
set = mongo['goodDynamicDetail']
set.create_index([('item_id', 1)])
print(set.index_information())
@classmethod
def good_comment(cls):
set = mongo['goodComment']
set.create_index([('product_id', 1)])
set.create_index([('item_id', 1)])
print(set.index_information())
@classmethod
def act_page(cls):
set = mongo['goodComment']
set.create_index([('act_page', 1)])
print(set.index_information())
@classmethod
def merchant(cls):
set = mongo['merchant']
set.create_index([('store_id', 1)])
print(set.index_information())
@classmethod
def act(cls):
set = mongo['act']
set.create_index([('url', 1)])
print(set.index_information())
@classmethod
def category_filter(cls):
set = mongo['categoryFilter']
set.create_index([('category_id', 1)])
print(set.index_information())
@classmethod
def cart(cls):
set = mongo['cart']
set.create_index([('phoneNum', 1)])
print(set.index_information())
@classmethod
def information(cls):
set = mongo['information']
set.create_index([('id', 1)])
set.create_index([('phoneNum', 1)])
print(set.index_information())
CreateIndex.information()
CreateIndex.merchant()
CreateIndex.good_comment()
CreateIndex.good_category()
CreateIndex.good_static_detail()
CreateIndex.good_dynamic_detail()
CreateIndex.cart()
CreateIndex.act()
CreateIndex.act_page()
CreateIndex.category_filter()