{"action":"created","issue":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/45","repository_url":"https://api.github.com/repos/OpenKitten/MongoKitten","labels_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/45/comments","events_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/45/events","html_url":"https://github.com/OpenKitten/MongoKitten/issues/45","id":181657008,"number":45,"title":"Cannot create dynamic Document for arrays and nested jsons","user":{"login":"sujaykakkad","id":22329179,"avatar_url":"https://avatars.githubusercontent.com/u/22329179?v=3","gravatar_id":"","url":"https://api.github.com/users/sujaykakkad","html_url":"https://github.com/sujaykakkad","followers_url":"https://api.github.com/users/sujaykakkad/followers","following_url":"https://api.github.com/users/sujaykakkad/following{/other_user}","gists_url":"https://api.github.com/users/sujaykakkad/gists{/gist_id}","starred_url":"https://api.github.com/users/sujaykakkad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sujaykakkad/subscriptions","organizations_url":"https://api.github.com/users/sujaykakkad/orgs","repos_url":"https://api.github.com/users/sujaykakkad/repos","events_url":"https://api.github.com/users/sujaykakkad/events{/privacy}","received_events_url":"https://api.github.com/users/sujaykakkad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":33,"created_at":"2016-10-07T12:31:16Z","updated_at":"2016-12-06T10:36:52Z","closed_at":null,"body":"```\nvar username = \"mongo\"\nvar array = [1,2,3,4]\nvar dict = [\"name\": \"kitten\", \"type\": \"cat\"]\n\nlet userCollection = database[\"users\"]\n\nlet userDocument: Document = [\n            \"username\":  .string(username),\n            \"array\": .array(arr),\n            \"dictionary\": .array(dict),\n        ]\n\ntry userCollection.insert(userDocument)\n```\n\n```\nerror: cannot convert value of type '[Int]' to expected argument type 'Document'\n              array: .array(array),\n                            ^~~~~\n```\n\nWhy do you need Document type and why can't we create it dynamically? \n\nPlease provide JSON or Dictionary datatype support for queries in mongodb or atleast provide raw query support so that we can use raw strings to query mongo database\n"},"comment":{"url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/comments/265116557","html_url":"https://github.com/OpenKitten/MongoKitten/issues/45#issuecomment-265116557","issue_url":"https://api.github.com/repos/OpenKitten/MongoKitten/issues/45","id":265116557,"user":{"login":"sujaykakkad","id":22329179,"avatar_url":"https://avatars.githubusercontent.com/u/22329179?v=3","gravatar_id":"","url":"https://api.github.com/users/sujaykakkad","html_url":"https://github.com/sujaykakkad","followers_url":"https://api.github.com/users/sujaykakkad/followers","following_url":"https://api.github.com/users/sujaykakkad/following{/other_user}","gists_url":"https://api.github.com/users/sujaykakkad/gists{/gist_id}","starred_url":"https://api.github.com/users/sujaykakkad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sujaykakkad/subscriptions","organizations_url":"https://api.github.com/users/sujaykakkad/orgs","repos_url":"https://api.github.com/users/sujaykakkad/repos","events_url":"https://api.github.com/users/sujaykakkad/events{/privacy}","received_events_url":"https://api.github.com/users/sujaykakkad/received_events","type":"User","site_admin":false},"created_at":"2016-12-06T10:36:52Z","updated_at":"2016-12-06T10:36:52Z","body":"cannot insert document with key as \"balance\"\r\n```swift\r\nlet doc: Document = [\"name\": \"mongo\"]\r\ndoc[\"balance\"] = 0.0\r\nprint(doc[\"balance\"]) //This prints balance as 0.0\r\ntry collection.insert(doc) //This inserts document but my balance field is not present\r\n```\r\nIn mongo database only object_id and name field are there\r\n```js\r\n{\r\n_id: ObjectId(\"3f934658aff5802af4ad7690\"),\r\nname: \"mongo\"\r\n}\r\n```\r\nIs there some bug with field name as \"balance\""}}
{"actor":{"display_login":"sujaykakkad"}}