{"action":"created","issue":{"url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1138","repository_url":"https://api.github.com/repos/mbdavid/LiteDB","labels_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1138/labels{/name}","comments_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1138/comments","events_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1138/events","html_url":"https://github.com/mbdavid/LiteDB/issues/1138","id":387906259,"node_id":"MDU6SXNzdWUzODc5MDYyNTk=","number":1138,"title":"Converting ints to longs","user":{"login":"KevinDJones","id":8009582,"node_id":"MDQ6VXNlcjgwMDk1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/8009582?v=4","gravatar_id":"","url":"https://api.github.com/users/KevinDJones","html_url":"https://github.com/KevinDJones","followers_url":"https://api.github.com/users/KevinDJones/followers","following_url":"https://api.github.com/users/KevinDJones/following{/other_user}","gists_url":"https://api.github.com/users/KevinDJones/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinDJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinDJones/subscriptions","organizations_url":"https://api.github.com/users/KevinDJones/orgs","repos_url":"https://api.github.com/users/KevinDJones/repos","events_url":"https://api.github.com/users/KevinDJones/events{/privacy}","received_events_url":"https://api.github.com/users/KevinDJones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-05T19:19:59Z","updated_at":"2018-12-05T19:32:28Z","closed_at":null,"author_association":"NONE","body":"I have a situation where I would like to change a field from int to long. In .NET, that's not a problem. An int can be assigned to a long no problem. However, in LiteDb, it throws an invalid cast exception. This is an issue as I have clients that have an object with an `int` saved. Is there anyway I can switch this to a long and still have it be read?\r\n\r\nExample:\r\n\r\n```\r\n   public class MyThing\r\n    {\r\n        public int MyNumber { get; set; }\r\n    }\r\n...\r\n    Database = new LiteDatabase(localDbConnectionString);\r\n    TestCollection = Database.GetCollection<MyThing>(\"things\");\r\n    var myThing = new MyThing();\r\n    myThing.MyNumber = 55;\r\n    TestCollection.Insert(myThing);\r\n    var things = TestCollection.FindAll();\r\n```\r\n\r\nThat all works fine. However, if I switch `MyThing` to a long:\r\n\r\n```\r\n   public class MyThing\r\n    {\r\n        public long MyNumber { get; set; }\r\n    }\r\n```\r\n\r\nAnd then run `TestCollection.FindAll()`, I get `Specified cast is not valid.'`. Anyway around that?\r\n"},"comment":{"url":"https://api.github.com/repos/mbdavid/LiteDB/issues/comments/444614222","html_url":"https://github.com/mbdavid/LiteDB/issues/1138#issuecomment-444614222","issue_url":"https://api.github.com/repos/mbdavid/LiteDB/issues/1138","id":444614222,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDYxNDIyMg==","user":{"login":"KevinDJones","id":8009582,"node_id":"MDQ6VXNlcjgwMDk1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/8009582?v=4","gravatar_id":"","url":"https://api.github.com/users/KevinDJones","html_url":"https://github.com/KevinDJones","followers_url":"https://api.github.com/users/KevinDJones/followers","following_url":"https://api.github.com/users/KevinDJones/following{/other_user}","gists_url":"https://api.github.com/users/KevinDJones/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinDJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinDJones/subscriptions","organizations_url":"https://api.github.com/users/KevinDJones/orgs","repos_url":"https://api.github.com/users/KevinDJones/repos","events_url":"https://api.github.com/users/KevinDJones/events{/privacy}","received_events_url":"https://api.github.com/users/KevinDJones/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T19:32:28Z","updated_at":"2018-12-05T19:32:28Z","author_association":"NONE","body":"Feel free to close the issue if there are any other workarounds other than converting each and every int to long like shown here https://github.com/mbdavid/LiteDB/issues/524#issuecomment-285698172"}}
{"actor":{"display_login":"KevinDJones"}}