Skip to main content
Version: 5.7.0

Custom Entity

Custom Entities are very similar to Global Entities, but with several advanced features that make them more applicable for larger data sets.

Like Global Entities, Custom Entites are:

  • available across all users of an app
  • access is controlled via ACL
  • have an entityType for organization
  • can have owners or be un-owned (as system objects)
  • can be automatically deleted via TTL (time-to-live)

Custom Entities differ in these ways:

  • You must pre-declare your entityTypes ahead-of-time
  • You can create custom indexes for each entityType for fast lookups
  • You can have an unlimited # of custom entities
  • You can do partial updates of custom entities
  • Custom entities support auto-migration during deployment

Custom Entities supports text index, $text operator can be use to query document fields once a text index is set up. Note that as the MongoDB restriction, one collection can have only one text index.

{
"entityType": "questions",
"context": {
"pagination": {
"rowsPerPage": 50,
"pageNumber": 1
},
"searchCriteria": {
"$text":{"$search": "moon"}
},
"sortCriteria": {
"createdAt": 1
}
}
}
tip

Custom Entities are a premium feature available to Plus Plan customers. Additional usage fees apply.

API Summary

Basic Access

  • CreateEntity - Creates new custom entity.
  • DeleteEntity - Deletes the specified custom entity on the server.
  • DeleteEntities - Deletes all applicable custom entities from the server based on the custom entity type and specified delete criteria.
  • DeleteSingleton - Deletes the specified custom entity singleton, owned by the session's user, for the specified entity type, on the server.
  • IncrementData - Increments the specified fields by the specified amount within custom entity data on the server.
  • IncrementDataSharded - Increments the specified fields by the specified amount within custom entity data on the server, enforcing ownership/ACL permissions.
  • IncrementSingletonData - Increments the specified fields, of the singleton owned by the user, by the specified amount within the custom entity data on the server.
  • ReadEntity - Reads a custom entity.
  • ReadSingleton - Reads the custom entity singleton owned by the session's user.
  • UpdateEntity - Replaces the specified custom entity's data, and optionally updates the acl and expiry, on the server.
  • UpdateEntityFields - Sets the specified fields within custom entity data on the server.
  • UpdateEntityFieldsSharded - For sharded custom collection entities. Sets the specified fields within custom entity data on the server, enforcing ownership/ACL permissions.
  • UpdateSingleton - Updates the singleton owned by the user for the specified custom entity type on the server, creating the singleton if it does not exist. This operation results in the owned singleton's data being completely replaced by the passed in JSON object.
  • UpdateSingletonFields - Partially updates the data, of the singleton owned by the user for the specified custom entity type, with the specified fields, on the server.

Paging

  • GetCount - Counts the number of custom entities meeting the specified where clause.
  • GetEntityPage - Retrieves first page of custom entities from the server based on the custom entity type and specified query context.
  • GetEntityPageOffset - Gets the page of custom entities from the server based on the encoded context and specified page offset.
  • GetRandomEntitiesMatching - Gets a list of up to maxReturn randomly selected custom entities from the server based on the entity type and where condition.

Bypassing ACL for System Objects

  • SysCreateEntity - Creates new custom entity.
  • SysDeleteEntity - Deletes the specified custom entity on the server.
  • SysDeleteEntities - Deletes all applicable custom entities from the server based on the custom entity type, specified delete criteria and acrossAllUsers flag.
  • SysGetCount - Counts the number of custom entities meeting the specified where clause.
  • SysGetEntityPage - Retrieves first page of custom entities from the server based on the custom entity type and specified query context
  • SysGetEntityPageOffset - Gets the page of custom entities from the server based on the encoded context and specified page offset.
  • SysGetRandomEntitiesMatching - Gets a list of up to maxReturn randomly selected custom entities from the server based on the entity type and where condition, bypassing ownership/ACL permissions checking.
  • SysIncrementData - Increments the specified fields by the specified amount within custom entity data on the server.
  • SysIncrementData - Increments the specified fields by the specified amount within custom entity data on the server, bypassing ownership/ACL permissions checks.
  • SysIncrementDataSharded - Increments the specified fields by the specified amount within custom entity data on the server, bypassing ownership/ACL permissions.
  • SysReadEntity - Reads a custom entity.
  • SysUpdateEntity - Replaces the specified custom entity's data, and optionally updates the acl and expiry, on the server.
  • SysUpdateEntityFields - Sets the specified fields within custom entity data on the server.
  • SysUpdateEntityFieldsSharded - For sharded custom collection entities. Sets the specified fields within custom entity data on the server, bypassing ACL permissions checks.
  • SysUpdateEntityOwner - Updates the owner of the custom entity.

Schema Management