mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

param null=True is no working ?

Open nonenull opened this issue 2 years ago • 1 comments

Example

use a URLField like this :

class Test(Document):
    test = URLField(null=True)

Test.objects.create(test='')

will get a error:

 mongoengine.errors.ValidationError: ValidationError (Test:None) (Invalid scheme  in URL: : ['test'])

nonenull avatar Aug 13 '21 02:08 nonenull

Using null=True will save null in the database if no value (None) was given. To allow empty strings override the URL-Regex (see docs).

der-joel avatar Dec 30 '21 16:12 der-joel