'How to populate a field (not in embedded document) from other embedded document in mongoose?
When tried by using populate method e.g. db[schemaName].find().populate("user_id") returns result as null.
1.schema: Users (Non embedded doc and need to populate user_id field)
user_id: { type: Schema.Types.ObjectId, ref: Sample.users } //Refers to sample users
2.schema: Sample (Embedded doc)
users : [{ name : String, address : address, _id:id },....],...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
