Server Code API to work with the database.
Collection API integration with the Appery.io Database. With this API you can access the database, search the database, create, update, and delete objects.
Using Server Code to Access the Database
We recommend to access the database from the Appery.io Server Code instead of accessing the database directly from the app. This approach has the following benefits:
- Sort the database results.
- Filter the database results.
- Query the database two or more times.
- Run any custom logic before, or after querying the database.
Method Summary
Collection has the following methods:
Method | Description |
---|---|
getCollectionList(dbApiKey) | Returns a list of a collection info of a specific database. |
createObject(dbApiKey, collectionName, objectJSON[, token]) | Creates an object in the specified collection. |
retrieveObject(dbApiKey, collectionName, objectId, include[, proj][, token]) | Retrieves an object from the specified collection. |
updateObject(dbApiKey, collectionName, objectId, objectJSON[, token]) | Updates object into the specified collection. |
multiUpdateObject(dbApiKey, collectionName, queryString, updateJSON, operationsJSON[, token]) | Updates multiple objects by specified values. |
deleteObject(dbApiKey, collectionName, objectId[, token]) | Deletes object from the specified collection. |
multiDeleteObject(dbApiKey, collectionName, queryString[, token]) | Deletes multiple objects from the specified collection that matches specified criteria. |
query(dbApiKey, collectionName[, params][, token]) | Queries a list of objects from a specified collection. |
distinct(dbApiKey, collectionName, columnName[, queryString][, token]) | Queries a list of distinct values from a specified collection’s column. |