-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmongo.py
More file actions
36 lines (28 loc) · 884 Bytes
/
Copy pathmongo.py
File metadata and controls
36 lines (28 loc) · 884 Bytes
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
from pymongo import MongoClient
class Mongo(object):
@staticmethod
def write_mongo(game):
# Create the client
client = MongoClient('localhost', 27017)
# Connect to our database
db = client['topgamer']
# Fetch our series collection
series_collection = db['games']
data = {
"Name": game.title,
"Price": game.price,
"Image": game.url_photo,
"Description": game.description,
"RealeaseDate": game.release_date,
"Genre": game.genre,
"Developer": game.developer,
"Publisher": game.publisher,
"OperatingSystem": game.operating_system,
"Processor": game.processor,
"VideoCard": game.graphics,
"DiskSpace": game.memory,
"Languages": game.language,
"Mark": game.rating,
"SteamLink": game.url_steam
}
result = series_collection.insert_one(data).inserted_id