Link Search Menu Expand Document

Reference - CRUD Operations

CRUD (an acronym for “create, read, update, delete”) operations can be thought of as the basic “building blocks” used by an API.

CodeBot generates CRUD operations by default, at various layers in the application. While CRUD API endpoints are generated, we do recommend that you focus your domain modeling on task-based APIs and application-layer operations.

However, the application code still needs to read and write to a database at some point, which is where the CRUD ops are chiefly used.

The full range of “CRUD ops” generated by CodeBot doesn’t really fit into a single acronym. However, for conistency and succinctness, we’ve stuck with the CRUD name throughout this documentation and elsewhere…

CRUD operations generated by CodeBot

Also see here for the same set of CRUD ops defined in the context of the REST API.

In the following table, we’ve used “item” to refer to an individual domain object/entity/record/row/instance (call it what you will!)…

Operation Notes
create Create one or more items
read one Find a single item via its ID. If the ID isn’t found, a “not found” (404) is returned.
find one Find a single item via a query. If the query doesn’t find anything, a “not found” (404) is returned.
find many Find 0 or more items via a query. If no items are found, an empty array is returned. For REST APIs, this is always a POST request with the JSON-based query in the request body.
get many Like find many, but with a GET request instead. The query is passed in as URL query parameters.
update Update individual attributes (not the whole record) as a single-item request, identified by the item ID. If the ID isn’t found, a “not found” (404) is returned.
replace Update the whole record (except for its ID) as a single-item request, identified by the item ID. If the ID isn’t found, a “not found” (404) is returned.
count Counts the number of items matching a query.
count all Counts all items in a collection/table.
delete one Deletes a single item, identified by the item ID.
delete many Deletes 0 or more items that match a query.

CodeBot also generates login and register operations; however these technically count as built-in task ops.