View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

Remove (Blueprint)

Remove a foreign record (e.g. a comment) from one of this record's collection associations (e.g. "comments").

DELETE /:model/:id/:association/:fk

This action removes a reference to some other record (the "foreign" record) from a collection attribute of this record (the "primary" record). Note that this does not actually destroy the foreign record-- it just removes it.

  • If the foreign record does not exist, it is created first.
  • If the collection doesn't contain a reference to the foreign record, this action will be ignored.
  • If the association is 2-way (i.e. reflexive, with "via" on both sides) the association on the foreign record will also be updated.


Parameter Type Details
The desired record's primary key value

e.g. 16
association The name of the collection association

e.g. 'employeesOfTheMonth'
The id of the foreign record to remove from the collection association.

e.g. 7
callback If specified, a JSONP response will be sent (instead of JSON). This is the name of the client-side javascript function to call, passing results as the first (and only) argument

e.g. ?callback=myJSONPHandlerFn


Remove Dolly (employee #7) from the employeesOfTheMonth list of store #16:

DELETE /store/16/employeesOfTheMonth/7
Expected Response
  "employeesOfTheMonth": [],
  "name": "Dolly",
  "createdAt": "2014-08-03T01:16:35.440Z",
  "updatedAt": "2014-08-03T01:51:41.567Z",
  "id": 16


  • If you'd like to spend some more time with Dolly, a more detailed walkthrough for the example above is available here.
  • This action is for dealing with plural ("collection") associations. If you want to set or unset a singular ("model") association, just use update.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book