This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users_info = read_users_info_from_csv(file_path) | |
for user in users_info: | |
LoyaltyUser(**user).save() | |
## With bulk operations: | |
users_info = read_users_info_from_csv(file_path) | |
users_to_insert = list() | |
for user in users_info: | |
users_to_insert.append(InsertOne(user)) | |
db.LoyaltyUser.bulk_write(users_to_insert) |