CRUD Operations

save

  • Returns: Model | { data: Model }

Save or update a model in the database, then return the instance.

create

const model = new Model({ foo: 'bar' })

model.save()
const model = new Model()

model.foo = 'bar'

model.save()
POST /resource

update

const model = await Model.find(1)

model.foo = 'bar'

model.save()
PUT /resource/1

delete

Delete the model from the database.

const model = await Model.find(1)

model.delete()
GET /resource/1
DELETE /resource/1