Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Method issue #265

Open
MayankJari opened this issue May 12, 2017 · 0 comments
Open

Save Method issue #265

MayankJari opened this issue May 12, 2017 · 0 comments
Labels

Comments

@MayankJari
Copy link

MayankJari commented May 12, 2017

After Creating Model and using create() method to store data , but as soon as i execute save() method it is not going inside save method , I don't know what is an issue.

var model = require('model');
var Listing = function(){

    this.defineProperties({
        name: { type: 'string', required: true },
        age : {type:'number',required : true}
    });

    this.setAdapter('postgres', {
        host: 'xxx.xxx.xx.xx',
        username: 'postgres',
        password: 'xxxxxxx',
        database: 'xxxxxxx'
    });
  //Connection Status  : Success
};
Listing = model.register('Listing',Listing);
var list = Listing.create({
    name : 'xyz',
    age : 20
});
 list.save(function (err, data) {
        if (err) {
            throw err;
        }
        console.log('New item saved!');
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants