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.1
Released: 2020-07-12T04:37:00Z
Last Updated: 2020-07-12T04:51:00Z
2.Documentation
Methods
• Initialize Firebase
Initializes the SDK.
Activate the firestore in your Firebase, in the rules, activate the reading and writing. In project settings in firebase, add your application. Download the google-service.json file and open it with a text editor, then get the following data:"project_id" ➜ projectId;
"mobilesdk_app_id" ➜ aplicationId;
"current_key" ➜ apiKey.
persistent ~ booleanRules
Remember to change your rules at the firestore; in this example, you can read and write to your database.
Note: Unfortunately it is currently not possible to secure the database with Firebase Auth, perhaps this will only become possible when the kodular adds a firestore component.
• 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.aia (2,5,MB)
4.Open Source
5.Credits
I thank @Aditya_Singh for the suggestion.
Thank you very much Kodular, 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