I'm using compound library for nodejs,
The primary key is autoincremental, after insertion in db thru a model object, the object has the id as NULL, but in the database has the correct number, how to get this number after calling "save()"?
var user = new User();
user.name = Math.random();
user.save();
console.warn(user);//the user.id is null, not the number in db
ps: is there also a way to use custom primary key names in the model instead of always id?
This is a rather old post, but in the event you are still looking for an answer;
Instead of using the synchronous save method I would suggest using the asynchronous create method.
For example:
The returned "newUser" object will contain the newly created id.