{"action":"created","issue":{"url":"https://api.github.com/repos/bguerout/jongo/issues/228","labels_url":"https://api.github.com/repos/bguerout/jongo/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/bguerout/jongo/issues/228/comments","events_url":"https://api.github.com/repos/bguerout/jongo/issues/228/events","html_url":"https://github.com/bguerout/jongo/issues/228","id":47241893,"number":228,"title":"Jongo Overriding the BasicDBObject to LazyBSONObject","user":{"login":"mukulgupta2507","id":4299536,"avatar_url":"https://avatars.githubusercontent.com/u/4299536?v=3","gravatar_id":"","url":"https://api.github.com/users/mukulgupta2507","html_url":"https://github.com/mukulgupta2507","followers_url":"https://api.github.com/users/mukulgupta2507/followers","following_url":"https://api.github.com/users/mukulgupta2507/following{/other_user}","gists_url":"https://api.github.com/users/mukulgupta2507/gists{/gist_id}","starred_url":"https://api.github.com/users/mukulgupta2507/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mukulgupta2507/subscriptions","organizations_url":"https://api.github.com/users/mukulgupta2507/orgs","repos_url":"https://api.github.com/users/mukulgupta2507/repos","events_url":"https://api.github.com/users/mukulgupta2507/events{/privacy}","received_events_url":"https://api.github.com/users/mukulgupta2507/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-10-30T07:54:53Z","updated_at":"2015-07-17T12:39:35Z","closed_at":null,"body":"Hi,\r\n\r\nI'm facing a weird issue while using jongo in my code. I have some legacy code written using BasicDBObject/DBObject. When I added jongo dependencies, it's giving me following exception:\r\n\r\n```java\r\norg.jboss.resteasy.spi.UnhandledException: java.lang.UnsupportedOperationException: Object is read only\r\n\tat org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)\r\n\tat org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)\r\n\tat org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:149)\r\n\tat org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:372)\r\n\tat org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)\r\n\r\nCaused by: java.lang.UnsupportedOperationException: Object is read only\r\n\tat org.bson.LazyBSONObject.put(LazyBSONObject.java:353)\r\n```\r\n\r\nMy legacy code is something like this:\r\n\r\n```java\r\nMongo mongo = new MongoClient();\r\nDBCollection coll = mongo.getDB(\"myDB\").getCollection(\"myCollection\");\r\nDBCursor cursor = coll.find(new BasicDBObject(\"key\",\"value\").toString());\r\nDBObject obj = cursor.next();       \r\nobj.put(\"newkey\":\"value\");          // showing error it seems can't modify the ready only object\r\n```\r\n\r\nI have following dependencies:\r\n```xml\r\n<fasterxml.jackson.core.version>2.3.0</fasterxml.jackson.core.version>\r\n<jongo.version>1.0</jongo.version>\r\n<mongo-java-driver.version>2.12.2</mongo-java-driver.version>\r\n```\r\n\r\nAny idea what can be a possible cause. It was working fine before adding jongo dependecies, my guess is jongo is overriding the internal behaviour of BasicDBObject and converting it to read only.\r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/bguerout/jongo/issues/comments/122262336","html_url":"https://github.com/bguerout/jongo/issues/228#issuecomment-122262336","issue_url":"https://api.github.com/repos/bguerout/jongo/issues/228","id":122262336,"user":{"login":"mox601","id":11626,"avatar_url":"https://avatars.githubusercontent.com/u/11626?v=3","gravatar_id":"","url":"https://api.github.com/users/mox601","html_url":"https://github.com/mox601","followers_url":"https://api.github.com/users/mox601/followers","following_url":"https://api.github.com/users/mox601/following{/other_user}","gists_url":"https://api.github.com/users/mox601/gists{/gist_id}","starred_url":"https://api.github.com/users/mox601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mox601/subscriptions","organizations_url":"https://api.github.com/users/mox601/orgs","repos_url":"https://api.github.com/users/mox601/repos","events_url":"https://api.github.com/users/mox601/events{/privacy}","received_events_url":"https://api.github.com/users/mox601/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T12:39:35Z","updated_at":"2015-07-17T12:39:35Z","body":"I hit this issue when trying to use the same MongoClient (and then get a DB used to build a Jongo instance) with spring-data. "}}