As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Kinvey.DataStore.update will override the whole record, not only update selected fields. What is the difference between Kinvey.DataStore.update and Kinvey.DataStore.save? How do I update only selected fields?
Best Answer
D
Damien Bell
said
about 8 years ago
Daniel,
We appreciate the feedback, however the feature that you're asking to do (update a single field) maps well to MySQL, but goes both against REST and Mongo standards. We allow users to query on specific fields with the understanding that the item they receive from these queries should be used for read-only purposes. As such, we encourage and gear our documentation towards dealing with whole objects rather than partial ones.
If you see any areas where our documentation can improve specifically, please contact me directly and I will work to get them up to snuff.
This isn't possible unfortunately as it would deviate from how Mongo stores objects and would go against our RESTful paradigm. The proper way to update a field is to grab the entire object, modify the fields you want and save / update it back to Kinvey.
To the other question: The difference between Save / Update is that save will create the item if it doesn't yet exist, whereas update will not, and will throw an error.
Please let me know if you have any other questions,
Updates an existing document. If the document does not exist, however, it is created.
Damien Bell
said
about 8 years ago
Daniel,
I actually didn't check the documentation, I spoke with the library owner, let me follow up with him and see if the documentation is out of date or if he misspoke.
Thanks,
d
daniel_sedlacek
said
about 8 years ago
Actually it does not matter if new object is created or not, the whole update function is pretty useless the way it is implemented. You should at least consider updating the documentation so that people won't waste their time trying to implement it.
Damien Bell
said
about 8 years ago
Answer
Daniel,
We appreciate the feedback, however the feature that you're asking to do (update a single field) maps well to MySQL, but goes both against REST and Mongo standards. We allow users to query on specific fields with the understanding that the item they receive from these queries should be used for read-only purposes. As such, we encourage and gear our documentation towards dealing with whole objects rather than partial ones.
If you see any areas where our documentation can improve specifically, please contact me directly and I will work to get them up to snuff.
Thanks,
m
megahard technologies
said
almost 5 years ago
atleast tell me what are all the posiible ways to achieve that. because people may implement their own logic and its not that efficient. i also faced an issue where once the data is submitted i need to change "status" field to submitted from "in progress" so i it would be better if u people have gave some standard ways to achieve that. and if i dont find some standard ways to achieve i will move to other database .......
m
megahard technologies
said
almost 5 years ago
kindly gave some examples on this,also how to design a table with such requirements. if u would have gave examples of how to avoid such single field updates thing. then kinvey is really a awesome product to use.......
T
Tayger
said
almost 5 years ago
I also have to say this is one of the most "painful" part to handle with Kinvey's data storage. Furthermore I have to contradict to Damien Bell: It IS possible in MongoDB to update a single column value. See documentation here
Why "painful"? You want to update a single column of collection but you normally don't have the WHOLE record(s) in memory in order to process the full update. So you first have to read the whole record(s) before you update it (more traffic). If I could choose I'd rather would prefer single column updates than single column reads.
Regards
P
Pranav J
said
almost 5 years ago
Tayger,
There is no way to update partial data in Kinvey using SDKs or REST APIs. There is no direct method to update a single field of an entity without providing other attributes. But you can try implementing it using old Business Logic using "collectionAccess" and "$set" operator. Check this link for collection access using Business Logic.
Thanks,
Pranav
T
Tayger
said
almost 5 years ago
Hi Pranav
First of all thank you for forwarding the $nearsphere problem, that is solved now!
Concerning update: I am aware that Kinvey does not support update operation by API functionalities as it's known in MongoDB. Sure it would be nice if it would be supported but the trick with the Business Logic might help! I'm sure I have to do such operations and will check therefore the Business Logic chapter. Can't even wait to look into it (have some other things doing there).
Some years ago the lowest granularity concerning Big Data/NoSQL was on record, no updates where allowed on single columns. An update at that time was deleting the current record (or set it unusable) and add a new one (with the updates in it). The demand for UPDATE by API was then so high that it's now part in most Big Data/NoSQL DBs. So it would have been nice there were an UPDATE command on API level since doing an update on Business Logic level is imho a workaround but for a "simple" update not the right place (if it has nothing to do with the concept of "Business Logic").
daniel_sedlacek
Kinvey.DataStore.update will override the whole record, not only update selected fields. What is the difference between Kinvey.DataStore.update and Kinvey.DataStore.save? How do I update only selected fields?
Daniel,
We appreciate the feedback, however the feature that you're asking to do (update a single field) maps well to MySQL, but goes both against REST and Mongo standards. We allow users to query on specific fields with the understanding that the item they receive from these queries should be used for read-only purposes. As such, we encourage and gear our documentation towards dealing with whole objects rather than partial ones.
If you see any areas where our documentation can improve specifically, please contact me directly and I will work to get them up to snuff.
Thanks,
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstDamien Bell
Daniel,
This isn't possible unfortunately as it would deviate from how Mongo stores objects and would go against our RESTful paradigm. The proper way to update a field is to grab the entire object, modify the fields you want and save / update it back to Kinvey.
To the other question: The difference between Save / Update is that save will create the item if it doesn't yet exist, whereas update will not, and will throw an error.
Please let me know if you have any other questions,
daniel_sedlacek
Hi Damien
this is what your documentation says:
<static> update(collection, document, options) → {Promise}
Updates an existing document. If the document does not exist, however, it is created.
Damien Bell
Daniel,
I actually didn't check the documentation, I spoke with the library owner, let me follow up with him and see if the documentation is out of date or if he misspoke.
Thanks,
daniel_sedlacek
Actually it does not matter if new object is created or not, the whole update function is pretty useless the way it is implemented. You should at least consider updating the documentation so that people won't waste their time trying to implement it.
Damien Bell
Daniel,
We appreciate the feedback, however the feature that you're asking to do (update a single field) maps well to MySQL, but goes both against REST and Mongo standards. We allow users to query on specific fields with the understanding that the item they receive from these queries should be used for read-only purposes. As such, we encourage and gear our documentation towards dealing with whole objects rather than partial ones.
If you see any areas where our documentation can improve specifically, please contact me directly and I will work to get them up to snuff.
Thanks,
megahard technologies
atleast tell me what are all the posiible ways to achieve that. because people may implement their own logic and its not that efficient. i also faced an issue where once the data is submitted i need to change "status" field to submitted from "in progress" so i it would be better if u people have gave some standard ways to achieve that. and if i dont find some standard ways to achieve i will move to other database .......
megahard technologies
kindly gave some examples on this,also how to design a table with such requirements. if u would have gave examples of how to avoid such single field updates thing. then kinvey is really a awesome product to use.......
Tayger
I also have to say this is one of the most "painful" part to handle with Kinvey's data storage. Furthermore I have to contradict to Damien Bell: It IS possible in MongoDB to update a single column value. See documentation here
Why "painful"? You want to update a single column of collection but you normally don't have the WHOLE record(s) in memory in order to process the full update. So you first have to read the whole record(s) before you update it (more traffic). If I could choose I'd rather would prefer single column updates than single column reads.
Regards
Pranav J
Tayger,
There is no way to update partial data in Kinvey using SDKs or REST APIs. There is no direct method to update a single field of an entity without providing other attributes. But you can try implementing it using old Business Logic using "collectionAccess" and "$set" operator. Check this link for collection access using Business Logic.
Thanks,
Pranav
Tayger
Hi Pranav
First of all thank you for forwarding the $nearsphere problem, that is solved now!
Concerning update: I am aware that Kinvey does not support update operation by API functionalities as it's known in MongoDB. Sure it would be nice if it would be supported but the trick with the Business Logic might help! I'm sure I have to do such operations and will check therefore the Business Logic chapter. Can't even wait to look into it (have some other things doing there).
Some years ago the lowest granularity concerning Big Data/NoSQL was on record, no updates where allowed on single columns. An update at that time was deleting the current record (or set it unusable) and add a new one (with the updates in it). The demand for UPDATE by API was then so high that it's now part in most Big Data/NoSQL DBs. So it would have been nice there were an UPDATE command on API level since doing an update on Business Logic level is imho a workaround but for a "simple" update not the right place (if it has nothing to do with the concept of "Business Logic").
As long as there is a solution I'm happy with it!
Regards and thank you
-
How do I use Kinvey in my web app?
-
Is it safe to include keys/secrets in my client-side JavaScript app?
-
Why is the activeUser null even though I am logged in?
-
Login does not work even though credentials are valid.
-
Social login doesn’t work.
-
Appending objects to an Array (HTML5 - JS)
-
New to node.js - need bootstrap to downloadfiles from Kinvey
-
Problem with Aggregation/Grouping
-
Internal Server Error using Twitter Sign Up
-
Data Store
See all 315 topics