ManInTheBox/nodejs.rs — Issue #1: Object.merge
Author: ManInTheBox
Created: 2012-03-05 22:43:11+00:00
State: open

Mozda napraviti neki helper da merge-uje mongoose object sa popunjenim iz forme

````javascript
var user = new User();

if (req.body.user) {
user = merge(user, req.body.user);
}
````

Treba da ide rekurzivno dok ne dohvati sve ugnjezdene objekte.
Na ovaj nacin se izbegava nesto slicno ovome:

````javascript
user = new User({
name: {
first: u.name.first,
last: u.name.last,
username: u.name.username
},
email: u.email,
password: u.password
});
````