I need to
update "users" Firestore collection documents
whereEqualTo("somefield", true)
For many updates I think it could be WriteBatch with a lot of updates, but maybe there is another smart way to do this?
For example, if I need to update 10M(millions) of users - it would be OutOfMemoryException on Android device.
IMHO the only way to achieve this is create cloud function for firestore which will get chunks of your data and then you can update a field you want.
Related
I would like to bundle a local realm database with an iOS app and publish it to the app store. The initial database will ship with about 500 data records in a table, named TableA.
Then, in an app update I would like to insert an additional 250 records to TableA.
What would be an optimal solution for this scenario?
I have thought about including a JSON file in the app update with the 250 new records, and writing the data from the JSON into the realm database. Can anyone provide feedback on this solution, or suggest a better one?
When user first open the app, check your condition, and then you can show a progress bar and do your job. I think it's fine.
Is it possible to get the DataPoints with history like last update date/creation data and original/updated value?
I need to get a user's weights, and sync them with my app, but, I need to know what records have been updated after I made the first get for a specific period (like last 01.01.2020 - 02.02.2020).
My app uses ionic and cordova with the health plugin, but that is not the point of my question. If needed I can write a new plugin to acces the fit data.
This is the existing plugin code to get the data: https://github.com/dariosalvi78/cordova-plugin-health/blob/master/src/android/HealthPlugin.java
It appears that you cannot get the history of the records.
So as the question states, I have a dynamoDB setup from which I am fetching data. My User end is configured in iOS, hence I am using the AWS iOS SDK. Although the documentation is alright, but its outdated a lot, and going through the documentations, many classes are deprecated.
I have 2 questions -
I have to fetch the latest entry from the DB always, so I am doing this by setting the scanforward = false and limit = 1 . Now I am calling query method from the dynamoDBObjectMapper, but there is also load method which also can be configured to do the same. My first question is that what is the difference between query and load if I have to fetch only the latest entry in the DB. Also what is the correct way to retrieve it?
I have to fetch this data in the most instantaneous way possible. I know about DynamoDBStream, but that is NOT an option. Basically I have to implement a long polling kind of feature, where I will get a call? whenever any data is changed OR continuously fetch data from the dynamoDB at a particular interval. Shall i use NSTimer and the same method call (load vs query) to fetch the latest entry in the DB?
Any help is greatly appreciated. Also if any developer working in Amazon can see this question, please remove the old documentation from AWS console and keep the latest ones. There are 5 documentation on the same thing, and all of them are outdated and deprecated.
Thanks for pointing that out. Can you give the links of the documentation that has deprecated classes? We will try to keep the latest ones and remove if there are any redundant deprecated references.
load() API is used to retrieve an item: Using an object's primary key load the corresponding item from the database. Look for an example here: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/dynamodb-object-mapper.html under "Retrieve an item" section.
query() API can be used to return any number of records that match the query. The query API enables you to query a table or a secondary index.
To answer your question, if you know the primary key of the record that you are trying to retrieve, you can use load() API, otherwise use query() API.
DynamoDBStreams work well for your use case. Otherwise you can intgerate AWS Lambda with DynamoDB table to do polling which will be cleaner than a timer based approach. This question is partially answered here: Hooks for AWS DynamoDB streams
I created an application and use Firebase as backend. In my application User can upload images and these images should be deleted after one week from the database. I don't know how I can delete stuff automatically and after an amount of time because the code is running on the devices of the user and maybe there will be hundreds of user. Does anyone have any idea how I can achieve that please ? Thanks
AFAIK Firebase doesn't have support for adding a parameter to a query. You could try adding Cloud Function with a trigger to run a delete query when something is written to the database. https://firebase.google.com/docs/functions/gcp-storage-events
I have an iOS social app that uses Firebase as the main database to store all the posts with time stamp included
What I want to achieve is to remove anything that is > 10 days old from my database.
Currently, I am checking this with this super inefficient way (The only way I know). Every time the user queries the firebase, I have swift code that also queries the ENTIRE database and delete all entries that is > 10 days old. This works but it is really inefficient...
What you're trying to do is currently best done on a server you control with a job that runs periodically to scan and delete the old items. You can use the admin SDK for that.
You should also have a index on the time field that you're using to determine how old it is, in order to optimize the query that generates the results.