gpt4 book ai didi

mongodb - GORM 独立 : no updateOne() with maps

转载 作者:行者123 更新时间:2023-12-02 14:40:10 28 4
gpt4 key购买 nike

在我的 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com