Every developer knows: Shipping is just the start. After your app has launched, you'll still have new features you want to add. Sometimes making these updates requires updating or transforming existing data stored in the cloud. For example, you may have read Brad's excellent post about how to make your text searchable and asked yourself, "How do I update all of my existing data?".
npm install parse
Remember, there are active clients out there constantly creating new data. So before you start updating existing data, you'll probably want to add a
beforeSave handler that you do in your data migration script.
Then, you will need to iterate over all of the existing objects in your collection to update them. The new
each method on
Parse.Query objects allows you to do just that. Even if you have tens of thousands of objects or more in a collection, it will return each one of them, giving you an opportunity to modify them as you see fit.
We've also added the
Parse.Cloud.useMasterKey() method to our node module. By supplying your master key and calling this method, you can transform objects belonging to all of your users without ever compromising their ACL-based security.
For example, if you have
Event objects and want to transform their
city field into a searchable text field called
cityTokens, you could run the following node script:
Then just run this script on your machine with
$ node migrate.js Updating object: 4JsHZTwVBS Updating object: MnZ4TzBDFT Updating object: OPndkI2iRk Updating object: WBuxcx3fHM Updating object: duyWWKKxu3 Updating object: jPGxPhjjvg ...
At Parse, we love seeing all of the great new features our developers are adding to their apps. These new additions to our API should help you launch them even faster!