meteor - Update array of objects leads to blank array -


please tell me i'm missing here. when update array of objects collection updates empty array. i'm using meteor-collection2-core , node-simple-schema.

path: method

testarray = [{     "institution": "swinburn",     "uniqueid": 1501036480813,     "qualification": "bachelor of commerce",     "completed": "2017" }]  profilecandidate.update('ntzj6ke8qzsvspmep', {$set: {educationqualifications: testarray}}); 

path: collection

export const profilecandidate = new mongo.collection('profilecandidate');  const profilecandidateschema = new simpleschema({   userid: {     type: string,     regex: simpleschema.regex.id   },   educationqualifications: { type: array, optional: true },   'educationqualifications.$': { type: object, optional: true },   'educationqualifications.$.uniqueid': { type: number, optional: true },   'educationqualifications.$.institution': { type: string, optional: true },   'educationqualifications.$.qualification': { type: string, optional: true },   'educationqualifications.$.completed': { type: string, optional: true } });  profilecandidate.attachschema(profilecandidateschema); 

in method, try this:

profilecandidate.update({userid: 'ntzj6ke8qzsvspmep'}, {$set: {educationqualifications: testarray}}); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -