persistence.js is an asynchronous Javascript database mapper library. You can use it in the browser, as well on the server (and you can share data models between them).
I have a problem, I want to save my entity if user submit the form clicking in a button, but when I set some value in entity object, my register is updated in my database !
entityObject.all().list(function(registers){
var myRegister = registers[0];
// myRegister is updated in my database
myRegister.someValue = 'value';
// I want to update this register just if user click to submit a for like this
function clickEvent(){
persistence.add(myRegister);
persistence.flush(function(){
// the register has been saved !
});
}
});
I have a problem, I want to save my entity if user submit the form clicking in a button, but when I set some value in entity object, my register is updated in my database !