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. Also it is considered 50% more efficient in pricing than Realtime Database. This extention uses Andriod X libraries.
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 ~ boolean
• Get Document Query
Get a list of documents according to the query, returning it in “GotQuery”.
collectionReference ~ text
query ~ list
Key: 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 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
documentReference ~ text
document ~ dictionary
• Get Document
Get all the field along with value for a specific document in a collection.
documentReference ~ text
collectionReference ~ text
• Updates Document
Updates the document.
documentReference ~ (collection/document) 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
Price
If paid through UPI: INR 1500
If paid through PayPal: USD 25 + USD 3 (Additional taxes for conversion to INR), Total: USD 28.
If paid through Bitcoin: Bitcoin of value USD 25.
PM for purchasing.
Credits
@Shreyash for his super Rush.
I have used the same description as of @jarlissonlira2 to make it easier for old users to understand the logic easily.
Things I have changed in the extention:
• 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
documentReference ~ text
document ~ dictionary
• Get Document
Get all the field along with value for a specific document in a collection.
documentReference ~ text
collectionReference ~ text