Hi i am having issue with using the new versions of node.js Earlier i used a code like this
label(for=\'user_sex\') Sex:
select(id=\'user_sex\', name=\'user[se
You are getting this error because you're not constructing your model instance properly. It expects a hash of properties and their corresponding values but the parameter you're are providing is a string instead.
From your code above, req.body.user is a hash {sex: "male"}
whereas req.body.user.sex is just a string "male". You can do;
user = new User({sex: "male"});
But you can't do;
user = new User("male");
That explains why your first "User" instance with req.body.user parameter works but fails with req.body.user.sex parameter.
I'm not sure yet what you're trying to achieve with var sex = new User(req.body.user.sex);
Do you want to create another User model instance? or an associated sex model?