Closed naran3434 closed 7 years ago
Hi @naran3434 could you post the code that causes this?
I spotted the problem and will fix it now, however I'd like to add this case as a test, so please post your code.
Hi @mblarsen kindly look at my code.
--framing array --
array = { first_name : data.first_name, last_name : data.last_name, email : data.email, password : data.password, number : { mobile : data.mobile, country_code : { code : data.country_code, country : data.country_short_code } }, status : 0 };
new DriverModel(array).save(function (err, result) { if (err) return res.send({err: err}); return res.json({status:1, data: result, msg: 'success'}); });
Here when if i try to access result variable or return it. i got the error.
Thanks
@naran3434 could you please add your schema as well + where you init the plugin AND please use code blocks to format your code above.
@naran3434 note that I did commit a possible fix already, but it has not been published yet. Could you please try it first?
An approach:
node_modules/mongoose-hidden
git clone https://github.com/mblarsen/mongoose-hidden.git node_modules/mongoose-hidden
Sure @mblarsen
Thank you @mblarsen. It's working as expected now.
Fixed by 79099be
@naran3434 0.9.3 published on NPM thanks for the help.
@mblarsen Thanks for the quick support.
saving data using model, while trying to access the result data i am receiving following error :
ReferenceError: undefine is not defined at getPath (/home/shreeya/Desktop/node/hitchahual/node_modules/mongoose-hidden/lib/mongoose-hidden.js:91:14) at /home/shreeya/Desktop/node/hitchahual/node_modules/mongoose-hidden/lib/mongoose-hidden.js:179:47 at Array.forEach (native) at /home/shreeya/Desktop/node/hitchahual/node_modules/mongoose-hidden/lib/mongoose-hidden.js:172:15 at model.Document.$toObject (/home/shreeya/Desktop/node/hitchahual/node_modules/mongoose/lib/document.js:2130:19) at model.Document.toJSON (/home/shreeya/Desktop/node/hitchahual/node_modules/mongoose/lib/document.js:2348:15) at Object.stringify (native) at stringify (/home/shreeya/Desktop/node/hitchahual/node_modules/express/lib/response.js:1064:12) at ServerResponse.json (/home/shreeya/Desktop/node/hitchahual/node_modules/express/lib/response.js:243:14) at /home/shreeya/Desktop/node/hitchahual/routes/mobile/driver.js:125:20 at /home/shreeya/Desktop/node/hitchahual/node_modules/mongoose/lib/model.js:3408:16 at /home/shreeya/Desktop/node/hitchahual/node_modules/mongoose/lib/document.js:2002:18 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)
Any support for this ?
Thanks in Advance.