{"action":"created","issue":{"url":"https://api.github.com/repos/mongodb/morphia/issues/777","labels_url":"https://api.github.com/repos/mongodb/morphia/issues/777/labels{/name}","comments_url":"https://api.github.com/repos/mongodb/morphia/issues/777/comments","events_url":"https://api.github.com/repos/mongodb/morphia/issues/777/events","html_url":"https://github.com/mongodb/morphia/issues/777","id":76774821,"number":777,"title":"Re-Open #764: @Index disableValidation is not used when finding the MappedField","user":{"login":"agiannone","id":3846061,"avatar_url":"https://avatars.githubusercontent.com/u/3846061?v=3","gravatar_id":"","url":"https://api.github.com/users/agiannone","html_url":"https://github.com/agiannone","followers_url":"https://api.github.com/users/agiannone/followers","following_url":"https://api.github.com/users/agiannone/following{/other_user}","gists_url":"https://api.github.com/users/agiannone/gists{/gist_id}","starred_url":"https://api.github.com/users/agiannone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agiannone/subscriptions","organizations_url":"https://api.github.com/users/agiannone/orgs","repos_url":"https://api.github.com/users/agiannone/repos","events_url":"https://api.github.com/users/agiannone/events{/privacy}","received_events_url":"https://api.github.com/users/agiannone/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mongodb/morphia/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/mongodb/morphia/labels/Waiting%20for%20Response","name":"Waiting for Response","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mongodb/morphia/milestones/19","html_url":"https://github.com/mongodb/morphia/milestones/1.1.0","labels_url":"https://api.github.com/repos/mongodb/morphia/milestones/19/labels","id":1121666,"number":19,"title":"1.1.0","description":"","creator":{"login":"evanchooly","id":195021,"avatar_url":"https://avatars.githubusercontent.com/u/195021?v=3","gravatar_id":"","url":"https://api.github.com/users/evanchooly","html_url":"https://github.com/evanchooly","followers_url":"https://api.github.com/users/evanchooly/followers","following_url":"https://api.github.com/users/evanchooly/following{/other_user}","gists_url":"https://api.github.com/users/evanchooly/gists{/gist_id}","starred_url":"https://api.github.com/users/evanchooly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanchooly/subscriptions","organizations_url":"https://api.github.com/users/evanchooly/orgs","repos_url":"https://api.github.com/users/evanchooly/repos","events_url":"https://api.github.com/users/evanchooly/events{/privacy}","received_events_url":"https://api.github.com/users/evanchooly/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":18,"state":"open","created_at":"2015-05-20T17:43:29Z","updated_at":"2015-07-08T16:07:27Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-05-15T16:11:48Z","updated_at":"2015-07-10T15:30:18Z","closed_at":null,"body":"@evanchooly I just ran our Integration Tests and spotted an issue with the fix. The indexes are indexed correctly when validation is disabled, however the namePath is used to build the key for the index and the namePath will be empty if the findField() method is not called. This means we end up with an empty key which in turn causes save() calls to fail (as it saves the index as _1).\r\n\r\nTo fix this issue, the following should work:\r\n\r\n```java \r\n            if (!\"$**\".equals(value) && !options.disableValidation()) {\r\n                List<String> namePath = new ArrayList<String>();\r\n                if ( findField(namePath, mc, value) == null) {\r\n                    throw new MappingException(format(\"Unknown field '%s' for index: %s\", value, mc.getClazz().getName()));\r\n                } else {\r\n                    StringBuilder sb = new StringBuilder();\r\n                    for (String s : namePath) {\r\n                        if (sb.length() != 0) {\r\n                            sb.append(\".\");\r\n                        }\r\n                        sb.append(s);\r\n                    }\r\n                    key = sb.toString();\r\n                }\r\n            }\r\n```\r\n\r\nThis way the key doesn't get overwritten by the empty namePath and uses the actual field.value() value as the key."},"comment":{"url":"https://api.github.com/repos/mongodb/morphia/issues/comments/120436910","html_url":"https://github.com/mongodb/morphia/issues/777#issuecomment-120436910","issue_url":"https://api.github.com/repos/mongodb/morphia/issues/777","id":120436910,"user":{"login":"agiannone","id":3846061,"avatar_url":"https://avatars.githubusercontent.com/u/3846061?v=3","gravatar_id":"","url":"https://api.github.com/users/agiannone","html_url":"https://github.com/agiannone","followers_url":"https://api.github.com/users/agiannone/followers","following_url":"https://api.github.com/users/agiannone/following{/other_user}","gists_url":"https://api.github.com/users/agiannone/gists{/gist_id}","starred_url":"https://api.github.com/users/agiannone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agiannone/subscriptions","organizations_url":"https://api.github.com/users/agiannone/orgs","repos_url":"https://api.github.com/users/agiannone/repos","events_url":"https://api.github.com/users/agiannone/events{/privacy}","received_events_url":"https://api.github.com/users/agiannone/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T15:30:18Z","updated_at":"2015-07-10T15:30:18Z","body":"Which snapshot can I use from Maven to test this?\r\n\r\nOnce you let me know I'll run our integration tests again to see if everything is working as expected with your proposed fix"}}