mercredi 18 février 2015

Mongoimport - using --upsertFields to extend documents subarray (not replace)

I have this collection



/**
* Poll Options Schema
*/
var PollOptionSchema = new Schema({
option:{type:String},
option_thumb:{type:Number,default:0},
votes:[{
type: Schema.ObjectId,
ref: 'Vote'
}]
});


I have numerous JSON files, each with the same documents (about 10000 documents) but each contains diffrent records in the votes array (dont ask why). how can I use mongoimport to extend each docuements vote array and not just replace it with another array?


Aucun commentaire:

Enregistrer un commentaire