我在猫鼬中有两个型号:
const user = mongoose.Schema({
name: String,
...
});
和
const moderator = mongoose.Schema({
name: String,
...
});
当我使用以下方式访问这些集合时:
user.find()
我得到了用户和版主的回复列表。
我想要实现的是将这两个列表连接在一起以获得基于此模型的列表:
const myDataSchema = mongoose.Schema({
user: {type: Schema.Types.ObjectId, ref: 'user'},
moderator: {type: Schema.Types.ObjectId, ref: 'moderator'}
});
将设置其中一个属性(用户或主持人)。
答案 0 :(得分:0)
我解决了我的问题。我没有使用猫鼬模式,而是创建了自己的对象"。我的代码:
W/TWC: TNRegNotificationCtxSession: 540533023984 | 10/04/16:57:35.623 | WARNING | 26 | TNRegNotificationCtxSession | Could not operate with notification context in twilsock. Error 9
E/TWC: TNWebsocket: 540501275888 | 10/04/16:57:35.624 | CRITICAL | 9 | TNWebsocket | Received error while waiting for message: Net Exception
它可能不是最有效的方式,但它有效。