A8Data
getApp
Returns all the "collections" of the provided "appID" and their respective executable methods.
Best used when you need to retrieve a cross-app collections list.
Then, from the collections list returned through the "getApp" function, you can select the "collection" that you would want to execute and call forth the needed "executable method".
Note: The available executable methods are: Find, Update, Insert, and Delete.
getApp(appId:string)
/* The "variable collections" returns the collections-list for the appID: "13815a6c-f003-427e-b17e-
f45fcb59d664". Here, you can use the "collections" variable to access the "find (or insert, update, and
delete)" executable method for the "Applicant_Data" collections. This will then return the result to the
"variable document".*/
var collections = await a8data.getApp("13815a6c-f003-427e-b17e-f45fcb59d664");
var document = collections.Applicant_Data.find({"id":0});
Methods
When working on your current app's collection list, you can directly use the "executable methods" without requiring the "getApp" function.
find
Returns a list of all the documents available for a particular collection of apps.
Optional: The "query object" field is optional. Also, you can filter individual documents within the collection.
find(query?:object)
// Displays all documents of the "Applicant_Data" collection.
await a8data.Applicant_Data.find()
// Displays only documents with the ID (0) from this "Applicant_Data" collection.
await a8data.Applicant_Data.find({ "id": 0 })
insert
Helps "insert" documents into a particular "collection" of the app.
insert(document:object)
/* Inserts a document (with the values: "id: 3", "age: 5", and "name: kowsiya") to the "Applicant_Data"
collection.*/
await a8data.Applicant_Data.insert
({
"id": 3,
"age": 5,
"name": "kowsiya"
})
update
Helps "update" the documents in a particular collection, provided an updated document and its documentID are available.
update(document: Object, documentId: number)
/* Updates the documentID (16298008) in the "Applicant_Data" collection with the given values ("id: 0", "age:
25", and "name: deepika").*/
await a8data.Applicant_Data.update
({
"id": 0,
"age": 25,
"name": "deepika"
},
16298008
)
delete
Helps "delete" a particular document in the collection when provided with the "documentID".
delete(documentId: number)
// Deletes the document with the "documentID: 16298016" in the "Applicant_Data" collection.
await a8data.Applicant_Data.delete(16298016)