How to insert rows in mysql Db , using light-orm in nodejs

i am new to ORM techniques and using light-orm for mysql and i am wondering how to insert any new row to the database using light-orm or suggest me the best ORM for nodejs and mysql.

thanks in advance.

Totally valid question. Without experience in ORM I tried to find an answer. That took me 30 minutes, and to find it I had to dig into the source-code itself, as there is no info in the documentation. (Will make a pull request afterwards).

Extracted from the documentation:

model.create(function(err, model) {});

That is good, but how do we get the model object you ask?

Here is the list of available methods in Collection object:

/**
 * Create model
 * @param data Attributes, that will be setted during construction
 */
createModel(data: {});

/**
 * Create model
 * @param {boolean} add True, if created model should be added to models list
 */
createModel(add: boolean);

/**
 * Create model
 * @param data Attributes, that will be setted during construction
 * @param {boolean} add True, if created model should be added to models list
 */
createModel(data: {}, add: boolean);

createModel(options?: any, add?: boolean) : Model {

Granted you have a table users with fields: login, password. Simple example (not tested) shall look something like the following:

var mysql = require('mysql'),
    lightOrm = require('light-orm');

lightOrm.driver = mysql.createConnection(require('./connection.json'));
lightOrm.driver.connect();
var UsersCollection = new lightOrm.Collection('users');
var model = UsersCollection.createModel({login: "mylogin", password: "mypass"}, true);
model.create(); // Write the changes to database

Overall the light-orm looks fine, if you feel comfortable - keep using it.