pymongo with flask
flask, pymongo
Solution
find() returns a Cursor object that you must iterate over to access the documents returned by the query. As in:
for post in posts.find():
# do something with post
Problem
I am trying to return my posts, but instead I get TypeError: 'Cursor' object is not callable. How can I correct this? Here is my code: ``` from flask import Flask from flask.ext.pymongo import PyMongo app = Flask(__name__) mongo = PyMongo(app) from pymongo import Connection connection = Connection() db = connection.test_database collection = db.test_collection @app.route('/') def home_page(): post = {"author":"mike","text":"jiii"} posts = db.posts posts.insert(post) return posts.find() if __name__=='__main__': app.run(debug=True) ```