I am trying to find an entry in MongoDB and filter the _id from the result.
Here is my code:
#app.py @app.route('/login', methods = ['GET', 'POST']) def login(): if request.method == "POST": password = request.form.get('password') email = request.form.get('email') db = get_db() data = db.author.find_one({'email' : email, 'password' : password}) print(data) return 'data' else: return render_template('login.html')
Output:
{'password': '123123', 'name': '<my_name>', 'email': '<my_email>', '_id': ObjectId('<an_object_id_string>')}
How to filter the _id field on output?
source share