@route('/locations', method='GET')
def get_location():
entity = db['locations'].find({'coordinate2d': {'$near': [37.871593, -122.272747]}}).limit(3)
if not entity:
abort(404, 'No nearby locations')
return entity
コードの上記部分の応答がある:パイソン/ボトル/ MongoDBの:サポートされていない応答タイプ:<type 'dict'>
Error 500: Internal Server Error
Sorry, the requested URL 'http://localhost:8080/locations' caused an error:
Unsupported response type: <type 'dict'>
がどのように型ボトルとしてMongoのからの情報はJSONとして返すことができることをつかむことができます?
問題を分解しようとしましたか?つまり、単純な辞書リテラルで 'db.find'呼び出しを置き換えましたか?それがそのように働くなら、問題はMongo関連でなければならない。ボトル関連ではありませんか? – Helgi
@Helgi私は持っていますが、もちろんボトルは通常の辞書リテラルで動作します。 MongoDB ObjectIdは扱えません。 –