forked from Sleeeeeepy/Square
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.py
125 lines (123 loc) · 3.22 KB
/
db.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
from pymongo import MongoClient
client = MongoClient("mongodb://test:[email protected]", 27017)
db = client.square
if __name__ == '__main__':
# db에 넣을 가데이터 나중에 제거해줘야함
user_list = [
{
"userid": "123",
"username": "john_doe",
"password": "123",
"prev_score" : 0,
"max_score": 98.77,
"max_score_date": "2023-10-12 16:18:40",
},
{
"userid": "456",
"username": "jane_smith",
"password": "123",
"prev_score" : 0,
"max_score": 98.77,
"max_score_date": "2023-10-12 16:18:40",
},
{
"userid": "789",
"username": "alice_wonderland",
"password": "123",
"prev_score": 0,
"max_score": 98.77,
"max_score_date": "2023-10-12 16:18:41",
},
{
"userid": "101112",
"username": "ghibli",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011121",
"username": "ghibli1",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011122",
"username": "ghibli2",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011123",
"username": "ghibli3",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011124",
"username": "ghibli4",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011125",
"username": "ghibli5",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011126",
"username": "ghibli6",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011127",
"username": "ghibli7",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011128",
"username": "ghibli8",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "1011129",
"username": "ghibli9",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
},
{
"userid": "10111210",
"username": "ghibli10",
"password": "pass123",
"prev_score": 0,
"max_score": 10.11,
"max_score_date": "2023-10-12 16:18:42",
}
]
# 현재 db를 비우고 가데이터를 넣는다
db.users.delete_many({})
db.achievement.delete_many({})
# db.users.insert_many(user_list)