{"action":"closed","issue":{"url":"https://api.github.com/repos/grails/grails-data-mapping/issues/605","labels_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/605/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/605/comments","events_url":"https://api.github.com/repos/grails/grails-data-mapping/issues/605/events","html_url":"https://github.com/grails/grails-data-mapping/issues/605","id":122486257,"number":605,"title":"ClassCastException using Mongo datastore","user":{"login":"paulfairless","id":458690,"avatar_url":"https://avatars.githubusercontent.com/u/458690?v=3","gravatar_id":"","url":"https://api.github.com/users/paulfairless","html_url":"https://github.com/paulfairless","followers_url":"https://api.github.com/users/paulfairless/followers","following_url":"https://api.github.com/users/paulfairless/following{/other_user}","gists_url":"https://api.github.com/users/paulfairless/gists{/gist_id}","starred_url":"https://api.github.com/users/paulfairless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulfairless/subscriptions","organizations_url":"https://api.github.com/users/paulfairless/orgs","repos_url":"https://api.github.com/users/paulfairless/repos","events_url":"https://api.github.com/users/paulfairless/events{/privacy}","received_events_url":"https://api.github.com/users/paulfairless/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-16T11:44:50Z","updated_at":"2015-12-16T15:01:27Z","closed_at":"2015-12-16T15:01:27Z","body":"Attempting to update using latest mongo (:mongodb:5.0.0.RC2) using Grails 2.5.3 and encountered the following exception while using fixtures plugin to create domain objects. The issue appears to reside in the in the datastore itself:\r\n\r\n```\r\njava.lang.ClassCastException: org.bson.Document cannot be cast to com.mongodb.DBObject\r\n\tat org.grails.datastore.mapping.engine.types.AbstractMappingAwareCustomTypeMarshaller.write(AbstractMappingAwareCustomTypeMarshaller.java:54)\r\n\tat org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec$CustomTypeEncoder.encode(PersistentEntityCodec.groovy:863)\r\n\tat org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec$CustomTypeEncoder.encode(PersistentEntityCodec.groovy:856)\r\n\tat org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encode(PersistentEntityCodec.groovy:493)\r\n\tat org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encode(PersistentEntityCodec.groovy:254)\r\n\tat org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)\r\n\tat org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)\r\n\tat com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:101)\r\n\tat com.mongodb.connection.InsertCommandMessage.writeTheWrites(InsertCommandMessage.java:43)\r\n\tat com.mongodb.connection.BaseWriteCommandMessage.encodeMessageBodyWithMetadata(BaseWriteCommandMessage.java:129)\r\n\tat com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160)\r\n\tat com.mongodb.connection.WriteCommandProtocol.sendMessage(WriteCommandProtocol.java:212)\r\n\tat com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:101)\r\n\tat com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:67)\r\n\tat com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:37)\r\n\tat com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159)\r\n\tat com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286)\r\n\tat com.mongodb.connection.DefaultServerConnection.insertCommand(DefaultServerConnection.java:115)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation$Run$2.executeWriteCommandProtocol(MixedBulkWriteOperation.java:455)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation$Run$RunExecutor.execute(MixedBulkWriteOperation.java:646)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation$Run.execute(MixedBulkWriteOperation.java:401)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:179)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:168)\r\n\tat com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:230)\r\n\tat com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:221)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:168)\r\n\tat com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:74)\r\n\tat com.mongodb.Mongo.execute(Mongo.java:782)\r\n\tat com.mongodb.Mongo$2.execute(Mongo.java:765)\r\n\tat com.mongodb.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:291)\r\n\tat com.mongodb.MongoCollectionImpl.bulkWrite(MongoCollectionImpl.java:245)\r\n\tat org.grails.datastore.mapping.mongo.MongoCodecSession.flush(MongoCodecSession.groovy:228)\r\n\tat org.grails.datastore.mapping.mongo.AbstractMongoSession.flush(AbstractMongoSession.java:67)\r\n\tat org.grails.datastore.gorm.GormInstanceApi.doSave(GormInstanceApi.groovy:206)\r\n\tat org.grails.datastore.gorm.GormInstanceApi$_save_closure5.doCall(GormInstanceApi.groovy:170)\r\n\tat org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:310)\r\n\tat org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:37)\r\n\tat org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:169)\r\n\tat org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:140)\r\n\tat grails.plugin.fixtures.builder.processor.FixtureBeanPostProcessor.postProcessAfterInitialization(FixtureBeanPostProcessor.groovy:45)\r\n\tat grails.spring.BeanBuilder.createApplicationContext(BeanBuilder.java:593)\r\n\tat grails.plugin.fixtures.builder.FixtureBuilder.createApplicationContext(FixtureBuilder.groovy:140)\r\n\tat grails.plugin.fixtures.files.FixtureFileLoader.load(FixtureFileLoader.groovy:56)\r\n\tat grails.plugin.fixtures.Fixture.load(Fixture.groovy:54)\r\n\tat grails.plugin.fixtures.FixtureLoader.load(FixtureLoader.groovy:46)\r\n\tat grails.plugin.fixtures.FixtureLoader.load(FixtureLoader.groovy:38)\r\n```"}}