Sorry if this question is a bit vague. I would like to display data from mongodb to a flask template, but I'm having troubles. This is what I have at this moment, but as you can see, it doesn't work. (I tried to be creative)
@app.route('/find')
def find():
collection = db.lists.find()
names = []
for data in collection:
names.append(data['name'])
return render_template("find.html", title="Find - Website", name=names)
I know that there has to be a better way to do it, and I would really appreciate it if somebody could show me. Thanks!!