Link to home
Start Free TrialLog in
Avatar of Arjun Kori
Arjun Kori

asked on

TypeError: Users.save is not a function

Hi ,
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'})
                })

Open in new window


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

Open in new window


Please help me out.
ASKER CERTIFIED SOLUTION
Avatar of Tomas Helgi Johannsson
Tomas Helgi Johannsson
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial