How to create a new instance of waterline model without saving it

1.2k Views Asked by At

This might be a very simple question but I don't find anything about it in the Waterline docs.

How is it possible to get an instance of a Waterline model without immediately saving it.

Model.create(data); // already written to database

I am looking for something like

var user = User.new(data); // new instance, not persistent so far
user.doSomething(withThis); // call method on instance
user.save(); // Now write it to database

Thanks

1

There are 1 best solutions below

2
On

Looks like you can utilize basic javascript instantiation. Check out this issue not sure if it has been fixed but you can follow the crumbs from there.

https://github.com/balderdashy/waterline/issues/763