loopback save instance code example
Example 1: loopback create many
this.productApi.create(
[
{name: "Toy Car"},
{name: "Purse"},
{name: "Charger"}
]
).subscribe((res)=>console.log(res))
Example 2: loopback upsert with where
PersistedModel.upsertWithWhere([where], data, callback)
Example 3: loopback upsert
PersistedModel.upsert(data, callback)
Example 4: loopback find or create
await server.models.Role.findOrCreate(
{where: {name: val} },
{name: val}
);