{"action":"opened","issue":{"url":"https://api.github.com/repos/jagi/meteor-astronomy/issues/259","labels_url":"https://api.github.com/repos/jagi/meteor-astronomy/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/jagi/meteor-astronomy/issues/259/comments","events_url":"https://api.github.com/repos/jagi/meteor-astronomy/issues/259/events","html_url":"https://github.com/jagi/meteor-astronomy/issues/259","id":126034074,"number":259,"title":"Can get parent attribute on validator","user":{"login":"ArthurGerbelot","id":8027826,"avatar_url":"https://avatars.githubusercontent.com/u/8027826?v=3","gravatar_id":"","url":"https://api.github.com/users/ArthurGerbelot","html_url":"https://github.com/ArthurGerbelot","followers_url":"https://api.github.com/users/ArthurGerbelot/followers","following_url":"https://api.github.com/users/ArthurGerbelot/following{/other_user}","gists_url":"https://api.github.com/users/ArthurGerbelot/gists{/gist_id}","starred_url":"https://api.github.com/users/ArthurGerbelot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArthurGerbelot/subscriptions","organizations_url":"https://api.github.com/users/ArthurGerbelot/orgs","repos_url":"https://api.github.com/users/ArthurGerbelot/repos","events_url":"https://api.github.com/users/ArthurGerbelot/events{/privacy}","received_events_url":"https://api.github.com/users/ArthurGerbelot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-11T20:52:43Z","updated_at":"2016-01-11T20:52:43Z","closed_at":null,"body":"Hi,\r\n\r\nI try to create a Astro validator object for Meteor.users collection but I have a problem.\r\nA good part of validation rules are based on very important field (user.level) \r\n\r\n```\r\nlet validPhoneNumber = Validators.if({\r\n  condition: function () {\r\n    return this.level === 1;\r\n  },\r\n  true: Validators.or([\r\n    uniquePhoneNumber,\r\n    Validators.empty()\r\n  ]),\r\n  false: Validators.and([\r\n    Validators.required(),\r\n    uniquePhoneNumber\r\n  ])\r\n})\r\n\r\nUsers = Astro.Class({\r\n  name: 'Users',\r\n  collection: Meteor.users,\r\n  fields: {\r\n    level: {\r\n      type: 'number',\r\n      default: 1,\r\n      validator: [\r\n        Validators.gte(1),\r\n        Validators.lte(3)\r\n      ]\r\n    },\r\n   /*...*/\r\n    'profile.cellPhone': {\r\n      type: 'string',\r\n      validator: validPhoneNumber\r\n    },\r\n  }\r\n});\r\n```\r\n\r\nBut the `cellPhone` field is on a `profile` object. And on the condition function `this` is a reference to `user.profile` instead of `user`..\r\nSo I can't get access to user level on validation.."}}