I am new to python tornado framework. I have a small collection of data in MongoDB. I am using a simple get function in my python file. I get a BadYieldError
when using the db.collection.find()
option. But db.collection.find_one()
works fine but it display only one record.
import tornado
import bson
from bson import json_util
from bson.json_util import dumps
class TypeList(APIHandler):
@gen.coroutine
def get(self):
doc = yield db.vtype.find()
self.write(json_util.dumps(doc))
The error is:
tornado.gen.BadYieldError: yielded unknown object MotorCursor()