簡體   English   中英

我如何在 mongoose 的另一個 objectId 中填充 objectId

[英]how can i populate objectId inside another objectId in mongoose

I have an chatList and inside it there is messageId as an object id refer to Message Model, and that message model has messages array and inside it senderId as an objectId refer to User Model, in the User Controller i like to populate chatList.messageId. messages.senderId 我嘗試但不工作。

那是我希望它工作的代碼

.populate('chatList.messageId.messages.senderId')

您可以關注此代碼


> ref_id means model reference id

.populate("ref_id")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM