0
でサブドキュメントを挿入し、彼らは唯一のサブドキュメントマングースはIサブ文書で、私はいくつかの例を見てきた別のサブドキュメント を挿入必要がある別のサブドキュメント
の最初のレベルに到達していこれは
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Infonodo = require('./infonodo.model');
var personSchema = new Schema({
rfc: {type:String,required:true,unique:true},
name: {type:String,required:true},
jobs:[
{
name: {type:String,required:true},
city: {type:String},
location: {type:String},
skills: [
{
name: {type:String,required:true},
time: {type:String,required:true},
where: {type:Number,required:true},
percentage: {type:String},
_info: { type: mongoose.Schema.Types.ObjectId, ref: 'Infospecific', index: true }
}
]
}
]
});
module.exports = mongoose.model('Person', personSchema);
私のモデルであり、
「スキル」への更新や挿入方法はわかりませんが、私は更新や「ジョブ」への挿入しか知りません。
具体的には、特定の仕事を知り、この仕事を更新したり、別のスキルを取り入れたりする必要があります。
誰かが私を助けることができますか?
はい、そこの配列の多くはスキルであり、そして私は、更新person.jobsを必要とするとき、私は、特にjobsorスキルを更新する方法を知らない 、私は人と他のモデルとの参照を行う必要があります.jobs.skills._info –