CRUD operations
Altogic has several database nodes to perform CRUD (create, read, update and delete) operations in the database.
Create operations
Altogic provides two nodes to create new objects in the database.
- Create Single Object - Creates a single object of a given model in the database. Accepts an object input link point, and the input object provides the required data to create the new object in the database. Before creating the object in the database, runs all built-in and custom validation rules to check the validity of the data.
- Create Multi Objects - Creates multiple objects of a given model in the database. Accepts a list input link point and the input list of objects provides the required data to create each new object in the database. Similar to single object creation, it runs all built-in and custom validation rules to check the validity of each input object that will be created in the database.
.png)
info
If you are creating sub-model objects, you need to set the id of the parent object under which the sub-object(s) will be created as a node parameter.
Read operations
There are four key nodes to fetch data from the database. These nodes either return a single object or a list of objects when executed. They either query the database using a unique object identifier to find the single object or use filters, pagination, and sort fields to return multiple data objects or randomly return the specified number of objects.
- Get Single Object by Id - As its name implies, this node returns a single object of the selected model from the database identified by the unique id. You can also perform lookups to join data from object reference fields when retrieving the data.
- Get Single Object by Query - Same as "Get Single Object by Id," but the object is identified by a query instead of an object identifier. If multiple objects match the query then the first matching object is returned.
- Get Multi Objects by Query - Instead of a single object, this node returns a list of objects from the database matching the specified filter query and sorted by the provided fields and direction. In addition, you can also specify the page number and page size parameters for pagination.
- Get Multi Objects Randomly - Retrieves the specified number of objects from the database randomly.
- Get Multi Objects & Count by Query - Very similar to Get Multi Objects by Query but returns the count information by default and you can also specify the filter query as a string parameter, meaning you can provide the filter query conditions as input to this node.
.png)
Update operations
Altogic has 4 cored nodes to perform update operations on database objects. You can either use an input object to specify the field updates or set which fields to update manually using expressions.
.png)
- Update Single Object by Id - This node takes the fields and values to update from its input object link point and updates the object identified with the unique object id.
- Update Multi Objects by Query - This node takes the fields and values to update from its input object link point and updates the objects matching the select query. Using this node, you can update multiple objects at the same with the provided update values. As the execution result, this node returns "updateInfo" showing how many objects matched the select query and, out of those matches, how many of them are updated.
- Update Object Fields by Id - This is similar to "Update Single Object by Id" node, yet the fields to update and their values are specified manually as expressions in the node properties panel. This node updates only one object identified with the unique object id.
- Update Object Fields by Query - This is similar to "Update Multi Objects by Query "node, yet the fields to update and their values are specified manually as expressions in the node properties panel. This node updates the objects that match the select query.
Delete operations
There are two key nodes to delete data in the database.
- Delete Single Object by Id - As its name implies, this node deletes a single object of the selected model identified by the unique id.
- Delete Multi Objects by Query - This node deletes multiple objects of the selected model from the database matching the specified filter query. As a result, it returns a delete info object which provides the total deleted objects count.
.png)