Arjun Kori
asked on
TypeError: Users.save is not a function
Hi ,
I have written a code for mongoDb Update.
But after compilation i am getting this error.
Please help me out.
I have written a code for mongoDb Update.
var _data = responses.devices;
var existingUser = {
'ipackages': _data.ipackages
}
Users.save(existingUser, function(err, result) {
if (err) {
console.log("Error : " + err)
}
console.log("## USE UPDATED Successfully ## ");
/* REDIS CACHE */
redisClient.hmset(key.toString(), newUser, function(err, reply) {
if(err){
console.log('Error : '+err)
//throw err;
}else{
console.log('Data : '+reply)
}
});
res.send({'message':'User Updated Successfully'})
})
But after compilation i am getting this error.
TypeError: Users.save is not a function
at D:\Ad\AdServer\routes\users.js:112:23
at Query.<anonymous> (D:\Ad\AdServer\node_modules\mongoose\lib\model.js:3398:16)
at D:\Ad\AdServer\node_modules\kareem\index.js:259:21
at D:\Ad\AdServer\node_modules\kareem\index.js:127:16
Please help me out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.