{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/4974","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/4974/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/4974/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/4974/events","html_url":"https://github.com/Automattic/mongoose/issues/4974","id":206783121,"number":4974,"title":"running virtual method from schema","user":{"login":"bonesoul","id":73215,"avatar_url":"https://avatars.githubusercontent.com/u/73215?v=3","gravatar_id":"","url":"https://api.github.com/users/bonesoul","html_url":"https://github.com/bonesoul","followers_url":"https://api.github.com/users/bonesoul/followers","following_url":"https://api.github.com/users/bonesoul/following{/other_user}","gists_url":"https://api.github.com/users/bonesoul/gists{/gist_id}","starred_url":"https://api.github.com/users/bonesoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonesoul/subscriptions","organizations_url":"https://api.github.com/users/bonesoul/orgs","repos_url":"https://api.github.com/users/bonesoul/repos","events_url":"https://api.github.com/users/bonesoul/events{/privacy}","received_events_url":"https://api.github.com/users/bonesoul/received_events","type":"User","site_admin":false},"labels":[{"id":335758689,"url":"https://api.github.com/repos/Automattic/mongoose/labels/needs%20clarification","name":"needs clarification","color":"EB219B","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-02-10T12:21:26Z","updated_at":"2017-02-10T18:50:02Z","closed_at":null,"body":"mongoose 4.8.1\r\n\r\ni have a virtual method in my model;\r\n\r\n```\r\n  schema.virtual('isModeratable').get(function () {\r\n    return options.moderated; // returns if content type is moderatable (ie, can have awaiting_moderation status).\r\n  });\r\n```\r\n\r\ni want to call from schema definition instead of instance;\r\n\r\n`    console.dir(model.schema.virtual('isModeratable'))`\r\n\r\nthis shows it's existince but how can i call it?"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/279031759","html_url":"https://github.com/Automattic/mongoose/issues/4974#issuecomment-279031759","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/4974","id":279031759,"user":{"login":"bonesoul","id":73215,"avatar_url":"https://avatars.githubusercontent.com/u/73215?v=3","gravatar_id":"","url":"https://api.github.com/users/bonesoul","html_url":"https://github.com/bonesoul","followers_url":"https://api.github.com/users/bonesoul/followers","following_url":"https://api.github.com/users/bonesoul/following{/other_user}","gists_url":"https://api.github.com/users/bonesoul/gists{/gist_id}","starred_url":"https://api.github.com/users/bonesoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonesoul/subscriptions","organizations_url":"https://api.github.com/users/bonesoul/orgs","repos_url":"https://api.github.com/users/bonesoul/repos","events_url":"https://api.github.com/users/bonesoul/events{/privacy}","received_events_url":"https://api.github.com/users/bonesoul/received_events","type":"User","site_admin":false},"created_at":"2017-02-10T18:50:02Z","updated_at":"2017-02-10T18:50:02Z","body":"by the way i've a hacked a way to call it;\r\n\r\n```\r\nlet isModeratableFunc = _.head(model.schema.virtual('isModeratable').getters);\r\n\r\nthen;\r\n\r\nisModeratableFunc()\r\n```"}}
{"actor":{"display_login":"bonesoul"}}