Preventing fetching all the data from Firebase using .childAdded in Swift - swift

When we call. childAdded function initially it fetches all the records from the given link. And then after that it fetches the only newly added record.
Is there any way to prevent fetching all the data from Firebase initially.
I want to show a popup whenever a new record is added in Firebase and i want to fetch only the latest record but .childAdded first fetches all the data in Firebase.

It's not possible unless you put a timestamp value in each record. If you have a timestamp, then you can query for only the children that have a timestamp greater than the current time. Typically one uses ServerValue.timestamp() as the value of a child to automatically get the server's sense of time into that field.

Related

AngularFire docData read value once

What is the correct way to read the content of a document as value without subscription ?
Keep in mind that when persistence is enabled the Observer receives two values, first value is the locally persisted one and the second is the actual value that is stored in the database.
You can use get() method to retrieve the contents of a single document.
For More details you can check this StackOverflow thread

Is there any way to get deleted row data from smartsheet using webhooks

To notify the events on smartsheet, I have created a webhook. Using I am able to get all events performing on sheet. If I delete a record manually, I am getting the deleted event with rowid, but not the total deleted row data. Is there any way to get the deleted row data?
Thanking you in advance
The callbacks that you receive via webhooks are simply intended to notify you when events occur -- i.e., by design, each callback contains only enough data to identify the event that triggered the callback.
Update 10/19/2020:
Unfortunately, you won't be able to use the Get Row operation to retrieve data for row after it's been deleted. Therefore, seems like you'd need to somehow write/save sheet data elsewhere as the sheet is modified (e.g., perhaps in response to webhook notifications that indicate row data was added/modified?), then you could query this saved sheet data to get row data as rows that are deleted from the actual sheet (i.e., in response to 'row deleted' webhook notifications).

Firestore How to access a value from a snapshot in a Document Snapshot stream

I'm new to dart/flutter and am building an app right now that keeps track of some data on each user in a firstore database. I have a 'Users' collection which contains a document for each user, and one of the fields in the user document is the "UID" received through firebase_auth.
That being said, to make sure I have access to the latest copy of a user document, I hold a Stream. I want to somehow access the "UID" field from the latest snapshot in the stream and then do some other operations with it.
Is there anyway to do this? Am I using/understanding streams incorrectly?
If you only ever need the UID to build other widgets, you can simply use a StreamBuilder which will rebuild its children whenever a new value is emitted from the stream (which you get a copy of). However, if you need to access the latest UID at some arbitrary point of time, check out RxDart's BehaviorSubject which provides constant-time synchronous access to the latest emitted value, if one exists. It is very helpful for handling state in general.

The correct HTTP method for resetting data

I want to "reset" certain data in my database tables using a RESTful method but I'm not sure which one I should be using. UPDATE because I'm deleting records and updating the record where the ID is referenced (but never removing the record where ID lives itself), or DELETE because my main action is to delete associated records and updating is tracking those changes?
I suppose this action can be ran multiple times but the result will be the same, however the ID will always be found when "resetting".
I think you want the DELETE method

Why JsonStore provides a commitchanges method

The extjs Jsonstore class has a method commitchanges().
Now considering that the javascript code will send an AJAX request to a servlet and not to a db directly, what do we need a commitchanges() method?
Whenever user changes anything in the form panel's or UI components that data is changed in record, but at this time record will maintain a list of modified properties in the record and store maintains a list of modified records in the store
So whenever you send a request to save the data to server, after successful save you will get back a success response, on this response store need to make sure that the saved record will be removed from the list of records that are modified in the store and also remove list of modifications from the record instance to indicate that save operation was successful
So the operations of removing list of modified properties from record instance is performed by record.commit method and operations of removing saved record from list of modified records from store is performed by store.commitChanges method which in turn will call record.commit for every record which is saved correctly on server