mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Bulk insert not validating document schema

Open StoneMoe opened this issue 6 years ago • 2 comments

class Post:
    author = ListField(CustomDictField())

Post.objects.insert([Post(author={"a": 1})])

This will insert a dict value to author field in document

StoneMoe avatar Dec 10 '19 07:12 StoneMoe

Any update on this? Using ClassName.objects.insert() does not validate 'required' fields as well. How to fix that?

svagier avatar Jan 19 '22 09:01 svagier

Any update on this? Using ClassName.objects.insert() does not validate 'required' fields as well. How to fix that?

I do data validating and type casting by myself, since validation feature in mongoengine is not consistent.

StoneMoe avatar Jan 19 '22 10:01 StoneMoe