We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class User { String id static mapping = { id generator: 'assigned' } }
def graeme = new User() graeme.id = 'graeme' graeme.save(flush:true) def user = User.get('graeme') user.save(flush:true, insert:false) // results in BulkWriteError{index=0, code=11000, message='E11000 duplicate key error collection ..
This is caused because there is no common session.
https://github.com/grails/grails-data-mongodb/blob/c8287aadad3777f308ff625096171c24f0eebaf4/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/engine/MongoCodecEntityPersister.groovy#L186-L188
https://github.com/grails/grails-data-mongodb/blob/c8287aadad3777f308ff625096171c24f0eebaf4/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/engine/MongoCodecEntityPersister.groovy#L255-L257
returns false because session.contains(obj) returns false
session.contains(obj)
The following resolves the situation, but it is not intuitive.
User.withSession { def user = User.get('graeme') user.save(flush:true, insert:false) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
This is caused because there is no common session.
https://github.com/grails/grails-data-mongodb/blob/c8287aadad3777f308ff625096171c24f0eebaf4/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/engine/MongoCodecEntityPersister.groovy#L186-L188
https://github.com/grails/grails-data-mongodb/blob/c8287aadad3777f308ff625096171c24f0eebaf4/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/engine/MongoCodecEntityPersister.groovy#L255-L257
returns false because
session.contains(obj)
returns falseThe following resolves the situation, but it is not intuitive.
The text was updated successfully, but these errors were encountered: