{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/1668","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/1668/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/1668/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/1668/events","html_url":"https://github.com/Automattic/mongoose/issues/1668","id":18633803,"number":1668,"title":"work around MongoDB 2dsphere validation","user":{"login":"aheckmann","id":166834,"avatar_url":"https://avatars.githubusercontent.com/u/166834?v=3","gravatar_id":"","url":"https://api.github.com/users/aheckmann","html_url":"https://github.com/aheckmann","followers_url":"https://api.github.com/users/aheckmann/followers","following_url":"https://api.github.com/users/aheckmann/following{/other_user}","gists_url":"https://api.github.com/users/aheckmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aheckmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aheckmann/subscriptions","organizations_url":"https://api.github.com/users/aheckmann/orgs","repos_url":"https://api.github.com/users/aheckmann/repos","events_url":"https://api.github.com/users/aheckmann/events{/privacy}","received_events_url":"https://api.github.com/users/aheckmann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Automattic/mongoose/labels/enhancement","name":"enhancement","color":"02d7e1"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/mongoose/milestones/4","html_url":"https://github.com/Automattic/mongoose/milestones/3.8.x","labels_url":"https://api.github.com/repos/Automattic/mongoose/milestones/4/labels","id":470304,"number":4,"title":"3.8.x","description":"","creator":{"login":"aheckmann","id":166834,"avatar_url":"https://avatars.githubusercontent.com/u/166834?v=3","gravatar_id":"","url":"https://api.github.com/users/aheckmann","html_url":"https://github.com/aheckmann","followers_url":"https://api.github.com/users/aheckmann/followers","following_url":"https://api.github.com/users/aheckmann/following{/other_user}","gists_url":"https://api.github.com/users/aheckmann/gists{/gist_id}","starred_url":"https://api.github.com/users/aheckmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aheckmann/subscriptions","organizations_url":"https://api.github.com/users/aheckmann/orgs","repos_url":"https://api.github.com/users/aheckmann/repos","events_url":"https://api.github.com/users/aheckmann/events{/privacy}","received_events_url":"https://api.github.com/users/aheckmann/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"closed","created_at":"2013-10-31T15:27:26Z","updated_at":"2013-12-18T05:29:05Z","due_on":null,"closed_at":"2013-12-18T05:29:05Z"},"comments":19,"created_at":"2013-08-27T21:00:30Z","updated_at":"2015-08-04T22:22:03Z","closed_at":"2013-12-14T22:56:12Z","body":"http://stackoverflow.com/questions/16388836/does-applying-a-2dsphere-index-on-a-mongoose-schema-force-the-location-field-to/17328860?noredirect=1\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/127778699","html_url":"https://github.com/Automattic/mongoose/issues/1668#issuecomment-127778699","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/1668","id":127778699,"user":{"login":"keithrz","id":1205551,"avatar_url":"https://avatars.githubusercontent.com/u/1205551?v=3","gravatar_id":"","url":"https://api.github.com/users/keithrz","html_url":"https://github.com/keithrz","followers_url":"https://api.github.com/users/keithrz/followers","following_url":"https://api.github.com/users/keithrz/following{/other_user}","gists_url":"https://api.github.com/users/keithrz/gists{/gist_id}","starred_url":"https://api.github.com/users/keithrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithrz/subscriptions","organizations_url":"https://api.github.com/users/keithrz/orgs","repos_url":"https://api.github.com/users/keithrz/repos","events_url":"https://api.github.com/users/keithrz/events{/privacy}","received_events_url":"https://api.github.com/users/keithrz/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T22:22:03Z","updated_at":"2015-08-04T22:22:03Z","body":"How is an actual geoJSON field handled?  The code commit only seems to test legacy coordinate pairs.\r\n\r\nI'm trying this model:\r\n```\r\nvar mySchema = new mongoose.Schema({\r\ngeolocation: {\r\n    type: {type: String},\r\n    coordinates: []\r\n  }\r\n)};\r\n\r\nmySchema.index({geolocation: '2dsphere'});\r\n```\r\n\r\nand if I do not specify geolocation in my insert, I get the failure message:\r\nMongoError: insertDocument :: caused by :: 16755 Can't extract geo keys from object, malformed geometry?: { _id: ... , geolocation: { coordinates: [] } ... }\r\n\r\nI've also tried this:\r\n```\r\ngeolocation: {\r\n    type: {type: String},\r\n    coordinates: {\r\n        type: [],\r\n        required: false\r\n    }\r\n```"}}