1client = MongoClient('localhost', 27017)
2db = client['countries_db']
3collection_currency = db['currency']
4
5with open('currencies.json') as f:
6 file_data = json.load(f)
7
8collection_currency.insert(file_data) # pymongo < 3.0
9collection_currency.insert_one(file_data) # pymongo >= 3.0
10collection_currency.insert_many(file_data) # pymongo >= 3.0
11
12client.close()