Adding a field to a document using upsert


#1

I have a collection members that i want to update. The document contains only a field telephonenumber and id.

I have several telephone numbers

I want to add an extra field names and i am using a method to do that

‘updatenumber’: function(tn,names){

      Members.update({
                 telephoneNumber: tn
              }, {
                 $set: {
                    telephoneNumber: tn,
                    names:names
                 }
              }, {
                  upsert: true
              });
              console.log(names);
  },

Although tn and names contain data from clientside, the field names is not added. Why is that?.