Hi,
My Question is similar to what have been asked here earlier. We have a similar requirement where we need to perform a bulk update from a json file without the knowledge of the property of an entity being changed. Hence it is difficult to update each entry (60000-80000 entries) by querying each entry.
Updating collection from BaaS using PUT needs to provide the property we want to update and it updates every entity.But we need to restrict the update to specific entries(which can be identified by name/uuid) where any property has changed.
I was hoping that while uploading the data , baas will check if any property of an entity(identified by name) has changed. If so it will update that property. Since it is not the happening, currently we have to delete the entire collection and then again create the collection with updated entries which is taking a lot of time.
Kindly let me know if there is any best way to do this.
Thanks!!!
Answer by Mike Dunker @Google
·
Jul 15, 2016 at 05:01 PM
There is a modified field that specifies the timestamp of when an element was last modified (milliseconds timestamp). You can find more information about this kind of timestamp at http://www.epochconverter.com/ .
You can conditionally update via a single query using something like this:
curl -v -XPUT "https://example.com/org/app/collection?ql=modified>1467331200000%20and%20uuid=8898d8a9-4aab-11e6-837f-02670c054e35" -H"Content-Type:application/json" -d'{"updateField","value"}'
This will update the field for the specific entity, but only if the entity had changed since July 1st GMT.
Does this solve your problem?