Skip to content
This repository

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

Open
tabdulradi opened this Issue January 03, 2013 · 1 comment

2 participants

Tamer Mohammed Abdul-Radi Sriram Velamur
Tamer Mohammed Abdul-Radi
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.

Sriram Velamur

@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
Something went wrong with that request. Please try again.