-
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
-
tableNameThe name of the table you want to create.
Returns any A promise
It creates a database with the name provided in the databaseName parameter
-
databaseNamestring The name of the database you want to create.
Returns Promise<boolean> A promise
It deletes the database with the given name
-
databaseNamestring 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
-
tableNameThe name of the table you want to put the document in. -
documentThe document to be inserted.
Returns any A promise
It deletes a document from a table
-
tableNameThe name of the table you want to delete the document from. -
documentIdThe documentId of the document you want to delete. -
conditionstring? 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
-
tableNamestring The name of the table in which the key is to be deleted. -
queryStringstring The cocDB query string. -
useIndexForFields(optional, default[])
Returns Promise A promise.
It deletes a table from the database
-
tableNameThe 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
-
tableNameThe name of the table you want to create an index on. -
jsonFieldThe name of the field in the JSON object that you want to index. -
dataTypeThe data type of the field. -
isUniqueIf true, the index will enforce that the column or columns do not contain any duplicate values. -
isNotNullIf true, the column will not allow null values.
Returns any A promise
It updates a document in a table
-
tableNameThe name of the table in which the document is to be updated. -
documentIdThe id of the document to be updated. -
documentThe document to be updated. -
conditionstring? 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
-
tableNameThe name of the table you want to query. -
queryObjectThis is the object that you want to query. (optional, default{}) -
optionsObject Optional parameter to add pagination. (optional, default{})-
options.pageOffsetnumber specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10 -
options.pageLimitnumber specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10
-
Returns any A promise
This function will return a promise that will resolve to an array of objects that match the queryObject
-
tableNameThe name of the table you want to query. -
queryObjectThis is the object that you want to query on. -
optionsObject Optional parameter to add pagination. (optional, default{})-
options.pageOffsetnumber specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10 -
options.pageLimitnumber specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10
-
Returns any A promise
It takes a table name and a document id and returns the document
-
tableNameThe name of the table in which the document is stored. -
documentIdThe id of the document you want to get.
Returns any A promise
MathAddResponse
Type: object
-
isSuccessboolean true is api is executed successfully false otherwise. -
errorMessagestring? 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
-
tableNamestring The name of the table in which the document is present. -
documentIdstring The document id of the document you want to update. -
jsonFieldsIncrementsObject This is a JSON object that contains the fields and their increments. -
conditionstring? 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 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
-
tableNamestring The name of the table you want to query. -
queryStringstring This is the query string that you want to execute. -
useIndexForFieldsArray<string> This is an array of fields that you want to use the index for. (optional, defaultnull) -
optionsObject Optional parameter to add pagination. (optional, default{})-
options.pageOffsetnumber specify which row to start retrieving documents from. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10 -
options.pageLimitnumber specify number of documents to retrieve. Eg: to get 10 documents from the 100'th document, you should specifypageOffset = 100andpageLimit = 10
-
Returns any A promise