{"action":"closed","issue":{"url":"https://api.github.com/repos/buunguyen/mongoose-deep-populate/issues/32","labels_url":"https://api.github.com/repos/buunguyen/mongoose-deep-populate/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/buunguyen/mongoose-deep-populate/issues/32/comments","events_url":"https://api.github.com/repos/buunguyen/mongoose-deep-populate/issues/32/events","html_url":"https://github.com/buunguyen/mongoose-deep-populate/issues/32","id":111286990,"number":32,"title":"deepPopulate with model specified in refPath","user":{"login":"simonccarter","id":4021369,"avatar_url":"https://avatars.githubusercontent.com/u/4021369?v=3","gravatar_id":"","url":"https://api.github.com/users/simonccarter","html_url":"https://github.com/simonccarter","followers_url":"https://api.github.com/users/simonccarter/followers","following_url":"https://api.github.com/users/simonccarter/following{/other_user}","gists_url":"https://api.github.com/users/simonccarter/gists{/gist_id}","starred_url":"https://api.github.com/users/simonccarter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonccarter/subscriptions","organizations_url":"https://api.github.com/users/simonccarter/orgs","repos_url":"https://api.github.com/users/simonccarter/repos","events_url":"https://api.github.com/users/simonccarter/events{/privacy}","received_events_url":"https://api.github.com/users/simonccarter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T22:44:08Z","updated_at":"2015-10-14T00:10:36Z","closed_at":"2015-10-14T00:10:36Z","body":"I have 2 schemas, activities and notifications.\r\n\r\nActivities:\r\n\r\n```\r\nvar mongoose = require('mongoose');\r\nvar deepPopulate = require('mongoose-deep-populate');\r\n\r\nvar activitySchema = mongoose.Schema({\r\n    actor_type      : String,\r\n    ....\r\n    actor           : {\r\n        type        : mongoose.Schema.Types.ObjectId,\r\n        required    : true,\r\n        refPath     : 'actor_type'\r\n    },\r\n    ...\r\n});\r\n\r\nactivitySchema.plugin(deepPopulate, {});\r\nmodule.exports = mongoose.model('Activity', activitySchema);\r\n```\r\n\r\nNotifications:\r\n\r\n```\r\nvar mongoose = require('mongoose');\r\nvar deepPopulate = require('mongoose-deep-populate');\r\n\r\nvar Schema = mongoose.Schema,\r\n    ObjectId = Schema.ObjectId;\r\n\r\nvar schema = Schema({\r\n    ...\r\n    activity         : {\r\n        type         :  ObjectId ,\r\n        ref          :  'Activity'\r\n    },\r\n    ....\r\n});\r\n\r\nschema.plugin(deepPopulate, {});\r\nmodule.exports = mongoose.model('Notification', schema);\r\n```\r\n\r\nQueries are of the form:\r\n\r\n```\r\n\tNotification\r\n\t\t.find({some condition})\r\n\t\t.deepPopulate('activity.actor activity.object')\r\n```\r\n\r\nI've tried different variations on this query. \r\n\r\nWhen finding a notification, i'm able to populate the activity field, but not able to populate sub documents, such as notification.activity.actor.\r\n\r\nYet, if i'm doing a find directly on activities, I can populate those documents (just using populate(), not the deepPopulate plugin).\r\n\r\nI'm not sure if this is a bug, missing feature, or something wrong with something else, but just wanted to check here I was not doing anything wrong.\r\n\r\nAny help, even if telling me this is not supported by deepPopulate, would be great.\r\n\r\nThanks, \r\n\r\n"}}