I have a remote MongoDB with scraped data that I want to display via webpage in Flask, but it seems to be running into issues. I'm able to add to the DB without issue, but displaying data from the DB seems like an impossible feat. I'm at a loss after repeated research. One common error is that the 'Cursor' object is not callable
Code:
from flask import Flask, render_template
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config["MONGO_URI"] = 'mongodb+srv://example:example@cluster0-zh34t.mongodb.net/test?retryWrites=true'
mongo = PyMongo(app)
@app.route("/")
def index():
doc = mongo.db.collection.find_one({"_id": 0})
return doc