-
Notifications
You must be signed in to change notification settings - Fork 0
api API
It makes a GET request to the root of the API
Returns any A function that returns a promise.
It takes a table name as a parameter and returns a promise that resolves to the response from the server
-
tableName
The name of the table you want to create.
Returns any A promise
It creates a database with the name provided in the databaseName parameter
-
databaseName
string The name of the database you want to create.
Returns Promise<boolean> A promise
It deletes the database with the given name
-
databaseName
string The name of the database to be deleted.
Returns Promise<boolean> A promise.
It takes a table name and a document as input and returns a promise
-
tableName
The name of the table you want to put the document in. -
document
The document to be inserted.
Returns any A promise
It deletes a document from a table
-
tableName
The name of the table you want to delete the document from. -
documentId
The documentId of the document you want to delete. -
condition
string? Optional coco query condition of the form "$.cost<35" that must be satisfied for delete to happen. See query API for more details on how to write coco query strings.
Returns any A promise
This function deletes all documents satisfying query condition from a table
-
tableName
string The name of the table in which the key is to be deleted. -
queryString
string The cocDB query string. -
useIndexForFields
(optional, default[]
)
Returns Promise A promise.
It deletes a table from the database
-
tableName
The name of the table to be deleted.
Returns any A function that takes a tableName as an argument and returns a promise.
Create an index on a table
-
tableName
The name of the table you want to create an index on. -
jsonField
The name of the field in the JSON object that you want to index. -
dataType
The data type of the field. -
isUnique
If true, the index will enforce that the column or columns do not contain any duplicate values. -
isNotNull
If true, the column will not allow null values.
Returns any A promise
It updates a document in a table
-
tableName
The name of the table in which the document is to be updated. -
documentId
The id of the document to be updated. -
document
The document to be updated. -
condition
string? Optional coco query condition of the form "$.cost<35" that must be satisfied for update to happen. See query API for more details on how to write coco query strings.
Returns any A promise
It gets the document after scanning table
-
tableName
The name of the table you want to query. -
queryObject
This is the object that you want to query. (optional, default{}
) -
options
Object Optional parameter to add pagination. (optional, default{}
)-
options.pageOffset
number specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
options.pageLimit
number specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
Returns any A promise
This function will return a promise that will resolve to an array of objects that match the queryObject
-
tableName
The name of the table you want to query. -
queryObject
This is the object that you want to query on. -
options
Object Optional parameter to add pagination. (optional, default{}
)-
options.pageOffset
number specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
options.pageLimit
number specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
Returns any A promise
It takes a table name and a document id and returns the document
-
tableName
The name of the table in which the document is stored. -
documentId
The id of the document you want to get.
Returns any A promise
MathAddResponse
Type: object
-
isSuccess
boolean true is api is executed successfully false otherwise. -
errorMessage
string? This property detailed explanation of why call failed.
This function will add the values of the fields in the jsonFieldsIncrements object to the corresponding fields in the document with the given documentId in the given table
-
tableName
string The name of the table in which the document is present. -
documentId
string The document id of the document you want to update. -
jsonFieldsIncrements
Object This is a JSON object that contains the fields and their increments.
Returns Promise<MathAddResponse> A promise
query
is a function that takes in a table name, a query string, and an optional useIndexForFields parameter, and
returns a promise that resolves to the result of the query
-
tableName
string The name of the table you want to query. -
queryString
string This is the query string that you want to execute. -
useIndexForFields
Array<string> This is an array of fields that you want to use the index for. (optional, defaultnull
) -
options
Object Optional parameter to add pagination. (optional, default{}
)-
options.pageOffset
number specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
options.pageLimit
number specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100
andpageLimit = 10
-
Returns any A promise