Closed
Description
I've been playing around with Flask and MongoDB today and really like them. Thanks very much for making integrating Flask with PyMongo easier.
I'm really surprised at how hard it is to return JSON from a view method, considering that's the first thing I tried and really only thing I want to do for this project. If this is integrating PyMongo and Flask, shouldn't there be an equivalent to flask.jsonify()
that works with BSON?
As you probably know, this won't work because jsonify can't deal with ObjectId:
@app.route('/search/<query>')
def search(query):
events = mongo.db.contributions.find({
'_user_lower' : query.lower()
})
events = { 'events': list(events) }
return jsonify(**events)
Akhenakh's awesome gist is working for me right now, but it seems like pymongo should offer this.
Metadata
Metadata
Assignees
Labels
No labels