heynemann / motorengine

Motorengine is a port of MongoEngine for Tornado.
http://motorengine.readthedocs.org
204 stars 67 forks source link

Set a field with "unique=True",the http request will depending without any response. #125

Open lican09 opened 7 years ago

lican09 commented 7 years ago

when i debug my tornado view_method,it hang out at saving step. I just remove "unique=True", it works fine.

sourcepirate commented 7 years ago

Could you share us with more details ? Like what is the scheme you are using and in what scenario you get this problem ??

lican09 commented 7 years ago
class BaseInfo(Document):
    name = StringField(unique=True)

class Demo(tornado.web.RequestHandler):
    @gen.coroutine
    def post(self):
        data_dict = json.loads(self.request.body)
        name = data_dict.get('name')

        obj = BaseInfo()
        obj.name = name
        re = yield obj.save()
        self.finish('saved Ok')

It works fine when I remove "unique=True". My MongoDB server version: 3.4.2, and motorengine version is up to date.

thekie commented 5 years ago

Is this still an issue? If so, could you please tell us which version of Python, Tornado and Motorengine you're using. Thank you!