node.js - Populate array with object ID inside -
I have this in my model:
User.js:
... User Group: [{User Group: {type: mongoose.Schema.Types.ObjectId, Reference: 'UserGroup'}, Status: {Type: string, Default: 'Pending'}}], .. . When a user joins the user group, the group id user is stored in the user group area of the model array, and the status field is pending pending, an administrator Is awaiting approval. I can not fill a problem with an array of IDs, but I'm not sure when the field is populated then it is connected with the other.
Am I doing my model wrong or something is obvious?
Please help!
Thanks
What are you looking for this?
Schema.Fund ({}). Populate ('UserGroup User User'). Exec (...);
Comments
Post a Comment