diff --git a/insert_food_data.py b/insert_food_data.py index a9a2603b..10f501bf 100644 --- a/insert_food_data.py +++ b/insert_food_data.py @@ -10,4 +10,4 @@ for i in range(1, len(l)): temp = l[i].split(",") - mongo.db.food.insert({'food': temp[0], 'calories': temp[1]}) + mongo.db.food.insert_one({'food': temp[0], 'calories': temp[1]}) diff --git a/requirements.txt b/requirements.txt index c849055b..81ab8254 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -bcrypt==3.2.0 +bcrypt==4.0.1 blinker==1.4 bson==0.5.10 certifi==1.0.1 @@ -19,7 +19,7 @@ Jinja2==3.0.1 jwt==1.2.0 MarkupSafe==2.0.1 pycparser==2.20 -pymongo==3.11.3 +pymongo==4.5.0 python-dateutil==2.8.2 six==1.16.0 tabulate==0.8.9 diff --git a/tests/application.py b/tests/application.py index 2d26380a..a00d4adf 100644 --- a/tests/application.py +++ b/tests/application.py @@ -100,7 +100,7 @@ def register(): username = request.form.get('username') email = request.form.get('email') password = request.form.get('password') - mongo.db.user.insert({'name': username, 'email': email, 'pwd': bcrypt.hashpw( + mongo.db.user.insert_one({'name': username, 'email': email, 'pwd': bcrypt.hashpw( password.encode("utf-8"), bcrypt.gensalt())}) flash(f'Account created for {form.username.data}!', 'success') return redirect(url_for('home')) @@ -168,13 +168,13 @@ def user_profile(): temp = mongo.db.profile.find_one({'email': email}, { 'height', 'weight', 'goal', 'target_weight'}) if temp is not None: - mongo.db.profile.update({'email': email}, + mongo.db.profile.update_one({'email': email}, {'$set': {'weight': temp['weight'], 'height': temp['height'], 'goal': temp['goal'], 'target_weight': temp['target_weight']}}) else: - mongo.db.profile.insert({'email': email, + mongo.db.profile.insert_one({'email': email, 'height': height, 'weight': weight, 'goal': goal,