{"action":"closed","issue":{"url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/issues/137","labels_url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/issues/137/labels{/name}","comments_url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/issues/137/comments","events_url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/issues/137/events","html_url":"https://github.com/florianholzapfel/express-restify-mongoose/issues/137","id":97179260,"number":137,"title":"Support for nested populate?","user":{"login":"DavidBLynch","id":5412779,"avatar_url":"https://avatars.githubusercontent.com/u/5412779?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidBLynch","html_url":"https://github.com/DavidBLynch","followers_url":"https://api.github.com/users/DavidBLynch/followers","following_url":"https://api.github.com/users/DavidBLynch/following{/other_user}","gists_url":"https://api.github.com/users/DavidBLynch/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidBLynch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidBLynch/subscriptions","organizations_url":"https://api.github.com/users/DavidBLynch/orgs","repos_url":"https://api.github.com/users/DavidBLynch/repos","events_url":"https://api.github.com/users/DavidBLynch/events{/privacy}","received_events_url":"https://api.github.com/users/DavidBLynch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/florianholzapfel/express-restify-mongoose/labels/needs-test","name":"needs-test","color":"e53f42"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-25T01:29:56Z","updated_at":"2015-10-22T20:13:22Z","closed_at":"2015-10-22T20:13:22Z","body":"Assuming:\r\n\r\n```javascript\r\nvar postSchema = mongoose.Schema({\r\n    message: String,\r\n    lastModified: {\r\n        user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' },\r\n        date: Date\r\n    }\r\n}    \r\n```\r\nthen\r\n\r\n```\r\n[GET] api.com/posts/?populate=lastModified.user\r\n```\r\n\r\ngives this error:\r\n\r\n```\r\nTypeError: Cannot read property 'schema' of undefined\r\n    at findExcludedFieldsFor (d:\\arp\\node_modules\\express-restify-mongoose\\lib\\resource_filter.js:88:50)\r\n    at filterPopulated (d:\\arp\\node_modules\\express-restify-mongoose\\lib\\resource_filter.js:120:26)\r\n    ...\r\n```\r\n\r\nLooking at the code it's trying to break \"lastModified.user\" into path segments and then search in the schema.paths, but the schema already has the path entry as \"lastModified.user\" so path segments are not required.\r\n\r\n\r\n"}}