Strange case js mongoose

时间:2016-10-20 18:49:37

标签: javascript node.js mongodb express mongoose

I write simple app with expressjs and mongoose and I have strange problem.This is part of the code:

db.addOwner = function(obj){
var params = arguments[0],
    newOwner = Owner({
        firstName: params.firstName,
        lastName: params.lastName,
        age: params.age
    });

    newOwner
        .save()
        .then(console.log);
};

db.addCar = function(obj){
    var params = arguments[0],
        newCar = Car({
            model: params.model,
            year: params.year,
            hp: params.hp
        });

    newCar
        .save()
        .then(console.log);
};

The problem is that db.addOwner work but db.addCar don't.Do you have any ideas how to fix it?

0 个答案:

没有答案