在我的 good'ol grails (3.1.x) 应用程序中,我有类似的行
ModuleState.collection.updateOne(
[ compositeKey:ck ],
[ $set:[ compositeKey:ck, dateUpdated:new Date(), online:true ] ],
[ upsert:true ] )
在我使用
GORM standalone
的无 grails 应用程序中:compile 'org.grails:grails-datastore-gorm-mongodb:6.0.4.RELEASE'
此行引发异常
groovy.lang.MissingMethodException: No signature of method: com.mongodb.MongoCollectionImpl.updateOne() is applicable for argument types: (java.util.LinkedHashMap, java.util.LinkedHashMap, java.util.LinkedHashMap) values: [[compositeKey:111], [$set:[...]], ...] Possible solutions: updateOne(org.bson.conversions.Bson, org.bson.conversions.Bson), updateOne(org.bson.conversions.Bson, org.bson.conversions.Bson, com.mongodb.client.model.UpdateOptions)
因此,不会注入(inject)新的 map 消费方法。
有什么办法可以修复它并使 GORM 再次变得更好?
最佳答案
您需要添加org.grails:grails-datastore-gorm-mongodb-ext:6.0.4.RELEASE
到你的类路径
关于mongodb - GORM 独立 : no updateOne() with maps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41120665/