Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Grails 2.2.2 中创建了我的第一个应用程序 .. 对于数据库,我使用的是 MongoDb .. 但如果所有字段都未填写,它会给我一个错误..如何设置 mongoDb 字段允许 null
已尝试将字段的属性设置为可空
静态约束 = { fieldName nullable: true }
默认情况下,GORM 不允许将空值插入数据库,但您可以通过在 Config.groovy 中将其关闭全局: grails.gorm.default.constraints = { '*'(nullable: true) }