loopback find or create

JavaScript
 await server.models.Role.findOrCreate(
 	{where: {name: val} },
 	{name: val}
 );
Source

Also in JavaScript: