The unique identifier of the db object
The name of the model that the db object will be operating on
The http client to make RESTful API calls to the application's execution engine
Appends the input object to the object list field of a parent object identified by parentId
. This method is valid only for sub-model object-lists, object-lists with a parent. If this method is called for a top-level model object or sub-model object, an error will be returned.
If the id
is provided as input to this DBObject, its value will be ignored by this method since Altogic will automatically assign an id for new objects created in the database.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
An object that contains the fields and their values to create in the database
the id of the parent object.
Create operation options. By default no caching of the newly created object in Redis store and no top level object return
Returns the newly create object in the database.
Creates a top level model object in the database. This method is valid only for top-level models, models without a parent. If this method is called for a sub-model object or object-list, an error will be returned.
If the id
is provided as input to this DBObject, its value will be ignored by this method since Altogic will automatically assign an id for new objects created in the database.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
An object that contains the fields and their values to create in the database
Create operation options. By default no caching of the newly created object in Redis store.
Returns the newly create object in the database.
Deletes the document referred to by this DBObject and identified by the id
. For a top level model object this method deletes the object from the database and for sub-model objects either unsets its value or removes it from its parent's object list. If the id
of the db object is not defined, it returns an error.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Delete operation options. By default removes deleted object from Redis cache (if cached already) and no top level object return.
Returns null if the deleted object is a top-level object. If the deleted object is a sub-model object and if returnTop
is set to true in DeleteOptions, it returns the updated top-level object.
Gets the object referred to by this db object and identified by the id
from the database. If the id
of the db object is not specified, it returns an error.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Get operation options. By default no caching of the retrieved object in Redis store.
Returns the object identified by the id
or null if no such object exists in the database
Gets the object referred to by this db object and identified by the id
from the database. While getting the object it also performs the specified lookups. If the id
of the db object is not specified, it returns an error.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
The list of lookups to make (left outer join) while getting the object from the database
Get operation options. By default no caching of the retrieved object in Redis store.
Returns the object identified by the id
or null if no such object exists in the database
Sets the object field value of a parent object identified by parentId
. This method is valid only for sub-model objects, objects with a parent. If this method is called for a top-level model object or sub-model object-list, an error will be returned.
If the id
is provided as input to this DBObject, its value will be ignored by this method since Altogic will automatically assign an id for new objects created in the database.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
An object that contains the fields and their values to create in the database
the id of the parent object.
Create operation options. By default no caching of the newly created object in Redis store and no top level object return
Returns the newly create object in the database.
Updates the object referred to by this db object and identified by the id
using the input values. This method directly sets the field values of the object in the database with the values provided in the input.
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
An object that contains the fields and their values to update in the database
Update operation options. By default no caching of the updated object in Redis store and no top level object return
Returns the updated object in the database. If returnTop
is set to true in UpdateOptions and if the updated object is a sub-model or sub-model-list object, it returns the updated top-level object.
Updates the fields of object referred to by this db object and identified by the id
using the input FieldUpdate instruction(s).
If the client library key is set to enforce session, an active user session is required (e.g., user needs to be logged in) to call this method.
Field update instruction(s)
Update operation options. By default no caching of the updated object in Redis store and no top level object return
Returns the updated object in the database. If returnTop
is set to true in UpdateOptions and if the updated object is a sub-model or sub-model-list object, it returns the updated top-level object.
Generated using TypeDoc
References an object stored in a specific model of your application. It provides the methods to get, update, delete an existing object identified by its id or create, set or append a new object.
If id is provided when creatign an instance, you can use get, update, delete and updateFields methods. If no id specified in constructor, you can use create, set, and append methods to create a new object in the database.
create method is used to creat a top-level object, which does not have any parent. set method is used to set the value of an
object
field of a parent object and finally append is used to add a child object to anobject-list
field of a parent object.Since both set and append operate on a sub-model or sub-model list object respectively, you need to pass a
parentId
as an input parameter.