I am able to save to a custom db table I create in moralis server. My question is there a way to check if the .save was good right there like a try catch ? Or do I just check again with another .Query
I didn’t think on this before, what does save return on success? There should be a way to know if it succeeds or not.
Yes. I’m going to have to write a function to check right after I create seems a waste
maybe this syntax works:
newRes.save().then(function(response) {
alert("success");
}).catch(function(error) {
alert("error");
});
That didn’t but this got me where I wanted to go …
let response = cuser.save();
console.log(response);
Much better question… Does it cost money or is it even possible to define a custom db table with keys or like even two fields make up a unique key? Or even one field is unique. I am assuming the primary id is just random generated. Or any way to define some attributes to those fields ?
I don’t know exactly how you define a custom db table to do that automatically, what you could do would be to define a simple db table and add that logic in beforeSave