1.Introduction
Extension Name: Firestore
Cloud Firestore is Firebase's newest database for mobile app development. It builds on the successes of the Realtime Database with a new, more intuitive data model. Cloud Firestore also features richer, faster queries and scales further than the Realtime Database.
Latest Version: 1.0
Released: 2020-07-12T04:37:00Z
Last Updated: 2020-07-12T04:37:00Z
2.Documentation
Methods
β’ Initialize Firebase
Initializes the SDK.
Activate the firestore in your Firebase, in the rules, activate the reading and writing. In your project's settings in firebase, go to add application, select web, put a nickname and copy the following data:"projectId" β projectId;
"appId" β aplicationId;
"apiKey" β apiKey.
persistent ~ booleanRules
Remember to change your rules in the firestore, in this example it allows you to read and write to your database.
β’ Get Document Query
Get a list of documents according to the query, returning it in "GotQuery".
collectionReference ~ text
query ~ listKey: queryType, Value:
β’ limit ~ text
Key: value, Value: (Limit of documents returned ~ number)
β’ where ~ text
Key: value, Value: ~ dictonary
- Key: fieldpath, Value: ~ text
- Key: opStr, Value: (β==β,β>β,β>=β,β<β,β<=β)
- Key: value, Value: (value to be compared)
β’ orderBy ~ text
Key: value, Value: ~ dictonary
- Key: direction, Value: (βascβ, βdescβ)
- Key: field, Value: ~ text
β’ startAfter ~ text
Key: value, Value: (Start after that value)
β’ startAt ~ text
Key: value, Value: (Start at that value)
β’ endAt ~ text
*Key: value, Value: (end at that value)
β’ endBefore ~ text
Key: value, Value: (end before that value)
Example
In this example, all documents in the reference collection are left in ascending order relative to the "id" of the field and then a limit of 5 is placed.
Note: As we can see, the order of selection is from bottom to top in the list .
β’ Set Document
Set the documents
documentReference ~ text
document ~ dictionary
β’ Set Field With Merge
Update one field, creating the document if it does not already exist.
documentReference ~ text
document ~ dictionary
β’ Add Document
Add a new document with a generated id.
collectionReference ~ text
document ~ dictionary
β’ New Document
Create a new empty document with a specific name, if you want to create it by generating an id leave the documentName field empty.
collectionReference ~ text
documentName ~ text
β’ Updates Document
Updates the document.
collectionReference ~ text
document ~ dictionary
β’ Get All Docs
Gets the complete list of documents in the collection, returning to GotAllDocs.
collectionReference ~ text
β’ Register Listener
Register a listener and if there are changes to the collection it will return to OnListenerAdded, OnListenerModified, OnListenerRemoved.
collectionRefernce ~ text
β’ Remove Listener
Removes the listener.
collectionRefernce ~ text
β’ Delete Collection
Deleted collection.
collectionReference ~ text
β’ Delete Document
Deleted document.
documentReference ~ text
Events
β’ Got All Docs
Event returns all documents.
documents ~ list
β’ Got Query
Event returns a list with the selected data.
documents ~ list
β’ On Success
Returns the event if any method is successful.
message ~ text
β’ On Failure
Returns the error message.
message ~ text
β’ On Listener Added
When registering the listener, this event will be called when adding a field to the collection.
document ~ dictionary
β’ On Listener Modified
When registering the listener, this event will be called when modifying a field in the collection.
document ~ dictionary
β’ On Listener Removed
When registering the listener, this event will be called when removing a field from the collection.
document ~ dictionary
3.Downloads
Aix file: com.jdl.Firestore.aix (2.5 MB)
Aia file: Firestore_MIT.aia (2.5 MB)
4.Open Source
5.Credits
Thank you very much App Inventor, for being part of my life
6.Donate
If you liked my work, donate me any amount so that I can remain motivated to create free and open source extensions.
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=QJ76K7BA7KD3A¤cy_code=USD&source=url