Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Destroy a model in loopback.io

How can I delete a model in strongloop's loopback.io?

I have seen somewhere command called persistedModel.destroy()

but when I exectute slc persistedModel.destroy()

I get command not found error.

like image 574
Abhishek Goel Avatar asked Feb 14 '15 06:02

Abhishek Goel


People also ask

What is remote method in LoopBack?

A remote method is a method of a model, exposed over a custom REST endpoint. Use a remote method to perform operations not provided by LoopBack's standard model REST API. Note: The easiest way to define a remote method is by using the command-line remote method generator.

Is LoopBack an ORM?

When we talk about LoopBack, we're usually talking about rapid API generation. But behind the REST APIs is a full object-relational mapping (ORM) system that enables you to do all the standard create, read, update, and delete (CRUD) operations in your Node.

What is a repository in LoopBack?

In LoopBack 4, the layer responsible for this has been separated from the definition of the model itself, into the repository layer. A Repository represents a specialized Service interface that provides strong-typed data access (for example, CRUD) operations of a domain model against the underlying database or service.


1 Answers

Delete /common/models/your-model.js and /common/models/your-model.json, then delete the lines referencing your model in /server/model-config.json.

like image 105
superkhau Avatar answered Oct 03 '22 17:10

superkhau