Skip to content

Instantly share code, notes, and snippets.

@djfarly
Created February 22, 2022 17:46
Show Gist options
  • Save djfarly/2ea426eba761cae501bc1cb3c94e4cf6 to your computer and use it in GitHub Desktop.
Save djfarly/2ea426eba761cae501bc1cb3c94e4cf6 to your computer and use it in GitHub Desktop.
CRUD cheat sheet

CRUD

The acronym CRUD [kɹʌd] covers the four basic operations of persistent storage

  • Create, create a record,
  • Read or Retrieve, read a record,
  • Update, update a record, and
  • Delete or Destroy, delete a record.

These operations can be expressed using different terms depending on context or environment.

CRUD MongoDB SQL HTTP Method typical Rest URL (with HTTP Method)
Create insertOne / insertMany INSERT POST /todos
Read or Retrieve findOne / find SELECT GET /todos/[todoId] (one), /todos (all)
Update updateOne / updateMany UPDATE PUT / PATCH /todos/[todoId]
Delete or Destroy deleteOne / deleteMany DELETE DELETE /todos/[todoId]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment