Help with Updating a collection after sending email

Hi everyone,

Am trying to update my collection after sending email.

It happens that before sending the mail, i need to enter a quote number and after sending the mail i want to update my collection to store the inserted quote number.

I tried using collectionName.update(doc); and am getting the error bellow:(Cannot read _id of undefined).

Exception while invoking method ‘clicksend’ TypeError
: Cannot read property 'id’ of undefined
I20160310-17:23:22.502(2)? at [object Object].doValidate (packages/aldeed_co
llection2/packages/aldeed_collection2.js:246:1)
I20160310-17:23:22.502(2)? at [object Object].Mongo.Collection.(anonymous fu
nction) [as update] (packages/aldeed_collection2/packages/aldeed_collection2.js:
155:1)
I20160310-17:23:22.503(2)? at [object Object].Meteor.methods.clicksend (serv
er/learner.js:137:12)
I20160310-17:23:22.504(2)? at maybeAuditArgumentChecks (livedata_server.js:1
698:12)
I20160310-17:23:22.505(2)? at livedata_server.js:708:19
I20160310-17:23:22.505(2)? at [object Object].
.extend.withValue (packages/m
eteor/dynamics_nodejs.js:56:1)
I20160310-17:23:22.506(2)? at livedata_server.js:706:40
I20160310-17:23:22.507(2)? at [object Object]._.extend.withValue (packages/m
eteor/dynamics_nodejs.js:56:1)
I20160310-17:23:22.507(2)? at livedata_server.js:704:46
I20160310-17:23:22.508(2)? at tryCallTwo (C:\Users\ar19870708ar\AppData\Loca
l.meteor\packages\promise\0.5.1\npm\node_modules\meteor-promise\node_modules\pr
omise\lib\core.js:45:5)

Hm, it looks like doc in your code may be undefined. Unless that error is coming from a different line of code… or perhaps you have a nested document that collections2 is trying to validate? I think you need to provide more details or better: a github repo that reproduces this error.