Skip to content

Save Method issue #265

Description

@MayankJari

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!');
    });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions