Mongoengine runs validate also on non changed fields before saving. #208

Open
tabdulradi opened this Issue Jan 3, 2013 · 1 comment

Projects

None yet

2 participants

class User(Resource):
    state = IntField(required=True)
    name = SmallStringField(required=True)

u = User()
u.state = 1
u.name = "Tamer"
u.save()

u1 = User.objects.only('name').first()
u1.name = "Radian"
u1.save() # Fails because state is required

Mongoengine runs validate on all fields before save, even if there they are not changed. Which cases the above problem. I suggest save should validate changed fields only in case of partial documents.

I am running the stable Mongoengine version from pip.

@rozza I gather that this issue has been grouped under Features we are not sure of but any updates on what has been planned ? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment