【发布时间】:2020-01-19 21:02:19
【问题描述】:
我有这个模型
var clienteSchema = new mongoose.Schema({
nome: String,
profissao: String,
estado_civil: String,
data_nascimento: String,
cpf: String,
cidade: String,
endereco: String,
data_cadastro: {
type: Date,
default: Date.now
},
telefone: String,
estadias: [{
type: mongoose.Schema.Types.ObjectId,
ref: "Estadia"
}]
});
我正在尝试填充但无济于事。
Cliente.findById({ _id: req.params.id }).populate("estadias.Estadia").exec((err,cliente)=>{
我该怎么做?
【问题讨论】:
-
我想你只是想要
populate("estadias")
标签: javascript arrays node.js mongodb object